Я просматривал код моего друга и видел некоторые функции, такие как withPost
и другие, вот код
public function show($id)
{
$categorylist = Category::all();
$tagfoot = Tag::all();
$post = Post::find($id);
$popularposts= Post::selectRaw("posts.*, count('comments.id') as comments_count")->leftJoin('comments','comments.post_id', '=', 'posts.id')->groupBy('posts.id')->orderBy('comments_count', 'desc')->take(6)->get();
$prev = Post::where('id', '<', $post->id)->orderBy('id', 'desc')->first();;
$next = Post::where('id', '>', $post->id)->orderBy('id', 'desc')->first();
return view('posts.show')->withPost($post)->withTagfoot($tagfoot)->withCategorylist($categorylist)->withPrev($prev)->withNext($next)->withPopularposts($popularposts);
}
Что означают withPost
, withTagfoot
, withCategorylist
, withPrev
, withNext
, withPopularposts
функции на самом деле?