jeudi 1 août 2019

Requests in Controller

I'm sending ALL routes through a controller and do a find based on a slug.

If it's not finding a match in the DB in the slug, I'd like my controller to then try hit the next request.

I've tried adding

return $next($request);

But I get an error stating that $next is undefined.

public function view(Request $request, Closure $next)
{
// get page content
        $page = Page::where('route', $route)->first();

if($page)
{
  // Load Page
}
else
{
 return $next($request);
}
}

How do I get this to work?

Thanks



via Chebli Mohamed

Aucun commentaire:

Enregistrer un commentaire