本文整理汇总了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);
}