im not clear about you requirement but i hope this will help you if you have a user_id in your second table in your view or controller you can use
controller - if($object->user_id == Auth::id()){}
View - if($object->user_id == user()->id){}
Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.
Assuming I have an Users table which has the following fields
I have an Admin Middleware which Accepts/Rejects requests to Routes by checking the Role of the user. And I use Laravel's default Auth package to handle authentication.
Is this approach better when compared to having two separate tables? If admin part of the website shares sessions with the user part, if an authenticated normal user tries to access the admin panel, he may get the right to access if there's an admin whose id is the same as this normal user. What is the best approach in developing a Laravel 5.1 application where there are multiple user roles, which each user having independent operations.
Please or to participate in this conversation.