universal middleware to controll content according to roles
i want to do things like if you are admin and you look at user profile for you there will be option to ban that user or in chat room admin will have option to delete message of any user
I don't think a middleware is the way to go. It sounds more like you need a role/permissions based system. Laravel has this build in using Gate classes.
You can also do a conditional check in your view and/or controller right?
// view
@if (auth()->user()->role == 'member')
// Button to ban user
@endif
This is a basic example though. If you want to do more with Authorization you can create your own authorization rules. Check the documentation for more info! If you have questions let me know ;)