1

Target: restrict access to the part of spark routes until user did not accept custom form (agreement). All routes have to be restricted except custom agreement form, after user was logged in.

Is there any way to set up global middleware for laravel spark routes?

Looking to the sources and official documentation i can't find the way to do that. Maybe someone can help with this?

Ilya Rogojin
  • 321
  • 2
  • 11

1 Answers1

0

laravel-spark is a Laravel package that follow the same rules that applied to laravel,so in order to apply a middleware to set of laravel-spark routes you can define your middleware as specified here https://laravel.com/docs/5.5/middleware then open the routes.php file under spark folder (spark/src/Http/routes.php) and group your routes with your middleware :

$router->group(['middleware' => 'yourMiddleware'], function ($router) {
      //set of routes 
});

Hope that this will help you .

Mahmoud Abd AL Kareem
  • 615
  • 2
  • 10
  • 23