1. Home
  2. Laravel
  3. Abort unless

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

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