Skip to content
Advertisement

how to block a user for some blade unsing laravel 6?

I created a small site by laravel 6, with the four blade index, create, edit, show and an authentication system, I want everyone to see the blades index and show, and the blades create and edit prohibit that if user authenticate. TinghirsController.php

JavaScript

Route/web.php

JavaScript

Advertisement

Answer

As per the documentation, you can specify which controller methods you want to apply a piece of middleware to. In you’re case you want to apply the auth middleware to all methods except index and show.

To achieve change the middleware call in your __constructor method to be:

JavaScript
User contributions licensed under: CC BY-SA
7 People found this is helpful
Advertisement