NEW: abort_if() and abort_unless() - two small helpers

Another quick tip out of Laravel world - two new helper functions in the newest 5.2.22 version of the framework. They deal with abort() statement but make it a little prettier. Here's how. The usual way we do check-abort procedure:
if (!$order) {
  abort(404);
}
Now you can do it in one line:
abort_if(!$order, 404);
Isn't Laravel awesome? And there's also a direct opposite new function - abort_unless(). They were both introduced with a commit 18 days ago - here's how it looks internally: laravel abort_if Simple but nice, huh?

No comments or questions yet...

Like our articles?

Become a Premium Member for $129/year or $29/month
What else you will get:
  • 57 courses (1055 lessons, total 46 h 42 min)
  • 78 long-form tutorials (one new every week)
  • access to project repositories
  • access to private Discord

Recent Premium Tutorials