0

I am trying to use multiple middleware in a route as follows

Route::get('devices', ['as' => 'devices.index', 'uses' => 'deviceController@index', 'middleware' => ['permission:manage_devices', 'permission:device.view']]);

This will implement AND logic between the two middlewares. I want to implement an 'OR' Logic but could not find any help.

dmSherazi
  • 3,743
  • 5
  • 37
  • 62
  • 3
    I not sure you'll be able to this as middleware works like a waterfall process. I would suggest refactoring your permission middleware so that it can accept multiple params for an `OR` comparison. – Rwd Nov 30 '16 at 08:23
  • 1
    Post the content of your middleware files. I'm sure we can help you to join them in one or suggest something else. – Tomas Buteler Dec 02 '16 at 14:58

1 Answers1

1

Tough it isn't the most eloquent solution, you could try to create your own middleware that loads other middleware in a if/else or switch statement. That way you might be able to achieve the behaviour you'd want.

Check the docs on the link below on how to program your own middleware: https://laravel.com/docs/5.3/middleware#defining-middleware

Willem Leuverink
  • 164
  • 3
  • 12