findBlogById() public method

Find Blog by given id.
public findBlogById ( integer $id ) : Collection | null | static | Blog
$id integer
return Illuminate\Support\Collection | null | static | Yab\Quarx\Models\Blog
示例#1
0
 /**
  * Remove the specified Blog from storage.
  *
  * @param int $id
  *
  * @return Response
  */
 public function destroy($id)
 {
     $blog = $this->blogRepository->findBlogById($id);
     if (empty($blog)) {
         Quarx::notification('Blog not found', 'warning');
         return redirect(route('quarx.blog.index'));
     }
     $blog->delete();
     Quarx::notification('Blog deleted successfully.', 'success');
     return redirect(route('quarx.blog.index'));
 }