Yab\Quarx\Repositories\BlogRepository::findBlogsByURL PHP Method

findBlogsByURL() public method

Find Blog by given URL.
public findBlogsByURL ( string $url ) : Collection | null | static | Pages
$url string
return Illuminate\Support\Collection | null | static | Pages
    public function findBlogsByURL($url)
    {
        return Blog::where('url', $url)->where('is_published', 1)->first();
    }

Usage Example

Esempio n. 1
0
 /**
  * Display the specified Blog.
  *
  * @param int $id
  *
  * @return Response
  */
 public function show($url)
 {
     $blog = $this->blogRepository->findBlogsByURL($url);
     if (empty($blog)) {
         abort(404);
     }
     return view('quarx-frontend::blog.' . $blog->template)->with('blog', $blog);
 }