Book::deleting(function ($book) {
$book->update(['is_alive' => null]);
});
Book::restoring(function ($book) {
$book->update(['is_alive' => 1]);
}); $category = Category::where('slug', $slug)->firstOrFail();
$articles = $category->articles()->paginate(5); Route::get('/add_comment/{id}', 'CommentsController@addComment');public function addCommend($id)
{
//$id - ваш id
} как использовать QUERY SCOPES
Post::with('author')->customConditions()->get(); public function questions()
{
return $this->belongsToMany('Models\Question');
}User::find(1)->questions; Post::leftJoin('comments', 'comments.post_id', '=', 'posts.id')
->groupBy('posts.id')
->orderBy('comments_cnt', 'desc')
->select(\DB::raw("count(comments.id) as comments_cnt"))
->get();