A
A
asdasdqwe2021-11-09 17:26:43
Laravel
asdasdqwe, 2021-11-09 17:26:43

Guards vs Roles in laravel?

What is the best way to separate roles? Guards or just create a role_id in the table?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
A
Anton Anton, 2021-11-09
@asdasdqwe

How does one interfere with the other? In the general case, guards and policies allow you to use a bunch of helpers (in templates, in controllers, including resource ones, in middleware) and where they will get data for this from there (a field in the user model, a field in a separate role table, a field in table of the application object model, some combination of this (for example, author + moderator)) - all this is already described by the code.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question