本文整理匯總了PHP中app\Article::get方法的典型用法代碼示例。如果您正苦於以下問題:PHP Article::get方法的具體用法?PHP Article::get怎麽用?PHP Article::get使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類app\Article
的用法示例。
在下文中一共展示了Article::get方法的6個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: index
/**
* Display a listing of the resource.
*
* @return Response
*/
public function index()
{
$articles = Article::get();
// $articles = Article::Published()->get(); // อดีต
// $articles = Article::unPublished()->get(); // อนาคต
// dd($article); // dump and die
return view('articles.index', compact('articles'));
// return $articles; // return json object
// test class Auth
// return Auth::user()->id;
// session()->flash('flash_message', 'Edit completed');
// return session('flash_message');
}
示例2: article
/**
* Return a JSON response of the most recent article.
*
* @return \Illuminate\Http\Response
*/
public function article()
{
$article = \App\Article::get()->last();
return response()->json(['article' => $article]);
}
示例3: index
/**
* Display a listing of the resource.
*
* @return \Illuminate\Http\Response
*/
public function index()
{
$countarticles = Article::get()->count();
return view(athr . '.articles', ['title' => trans('author.articles'), 'countarticles' => $countarticles]);
}
示例4: index
/**
* Display a listing of the resource.
*
* @return \Illuminate\Http\Response
*/
public function index()
{
$articles = Article::get();
return view('articles.index', compact('articles'));
}
示例5: update
/**
* Update the specified resource in storage.
*
* @param Request $request
* @param int $id
* @return Response
*/
public function update($id, ArticleRequest $request)
{
$article = Article::get($id);
$article->update($request->all());
\Session::flash('flash_message', 'Article Edited');
return redirect('blog.index');
}
示例6: handle
/**
* Execute the job.
*
* @return void
*/
public function handle()
{
$articles = Article::get();
dd($articles);
}