Pass array to where method

Laravel you can pass an array to the where method.

1// Instead of this
2JobPost::where('company', 'laravel')
3 ->where('job_type', 'full time')
4 ->get();
5 
6// You can pass an array
7JobPost::where(['company' => 'laravel',
8 'job_type' => 'full time'])
9 ->get();

Tip given by @cosmeescobedo

Like our articles?

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