Add where company_id= $connected_company_id on all requests
I'm creating an online tool for companies that each have a set of users in
Laravel.
When a user is connected, he has a $connected_company_id variable
For every SELECT request (called by ::all(), find(), ...), i would like to
add the condition: where company_id = $connected_company_id
For every INSERT request, i would like to add the company_id.
Is this possible without changing my code everywhere ?
I thought about extending Eloquent with customEloquent, and then make my
models extend customEloquent, but I don't know how to write the code for
customEloquent and if it could work.
No comments:
Post a Comment