1. Home
  2. Laravel
  3. Abort if

The abort if function throws back a specified HTTP exception if the first attribute evaluates to true.

#laravel#helper
abort_if(! auth()->check(), 403, "Unauthorized");
copy
Full Laravel cheatsheet