Request: has any

You can check not only one parameter with $request->has() method, but also check for multiple parameters present, with $request->hasAny() :

1public function store(Request $request)
2{
3 if ($request->hasAny(['api_key', 'token'])) {
4 echo 'We have API key passed';
5 } else {
6 echo 'No authorization parameter';
7 }
8}

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