abort_if

The abort_if function throws an HTTP exception if a given boolean expression evaluates to true:
<?php abort_if(! Auth::user()->isAdmin(), 403);
<?php         $solution = app(SolutionProviderRepository::class)

            ->getSolutionForClass($this->get('solution'));



        abort_if(is_null($solution), 404, 'Solution could not be found');




        return $solution;
<?php     public function show(Request $request, $nav)

    {

        abort_if(! $nav = Nav::find($nav), 404);



        $site = $request->site ?? Site::selected()->handle();