A
A
Abc Edc2016-01-06 14:07:23
Laravel
Abc Edc, 2016-01-06 14:07:23

How to implement owners in laravel?

I need to introduce the concept of an entity owner, into an almost finished project, where roles are also implemented. The owner, for example, of the company entity, has access to editing only one specific company. It is the same with other entities. At the same time, multiple possession of exactly the essences can be different. I think to start by creating a table user_id | entity|entity_id and use the Gate class to set the rules, or at least make your own middleware. Yes, that's just how at the time of the request to catch which entity the user wants to view or edit, and is it really worth keeping some kind of config of the type of correspondence between the route and the entity on this route

Answer the question

In order to leave comments, you need to log in

1 answer(s)
S
Stanislav Pochepko, 2016-01-06
@gleber1

Look towards the Request and Policies objects (v5.1)

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question