better collection handlich in backend

This commit is contained in:
Arno Kaimbacher 2018-10-04 16:41:29 +02:00
parent 324eacf061
commit 50bcae442e
24 changed files with 623 additions and 68 deletions

View file

@ -92,13 +92,12 @@ class HomeController extends Controller
/**
* show page by $page_slug.
*/
public function showPage($slug)
public function showPage($slug): View
{
// $result = $pages->findBySlug($slug);
if (!is_null(Page::query()->wherePage_slug($slug)->firstOrFail())) {
$result = Page::query()->wherePage_slug($slug)->firstOrFail();
return view('frontend.pages.index')
->withpage($result);
if (!is_null(Page::query()->where('page_slug', $slug)->firstOrFail())) {
$result = Page::query()->where('page_slug', $slug)->firstOrFail();
return view('frontend.pages.index')->withpage($result);
} else {
throw new GeneralException(trans('exceptions.backend.access.pages.not_found'));
}