Support the ongoing development of Laravel.io →
Security Eloquent Views
Last updated 2 years ago.
0

For the views maybe you can use nested views.

For the controller i don't see any other solution than doing two different request.

Last updated 2 years ago.
0

I just filter that kind of thing at the repository level. For example, I might have a ComputerRepository class with a getAll function but also a FilterByRoleId function. At the controller level, I'll do something like this:

function index()
{
    $computers = $this->repo->filterByRoleId(Auth::user()->role)->getAll();
    
    return View::make('computers.list', compact('computers'));
}
Last updated 2 years ago.
0

thepsion5 said:

I just filter that kind of thing at the repository level. For example, I might have a ComputerRepository class with a getAll function but also a FilterByRoleId function. At the controller level, I'll do something like this:

function index()
{
   $computers = $this->repo->filterByRoleId(Auth::user()->role)->getAll();
   
   return View::make('computers.list', compact('computers'));
}

And if it were also multi-tenant?

Last updated 2 years ago.
0

Sign in to participate in this thread!

Eventy

Your banner here too?

KuenzelIT kuenzelit Joined 9 Jul 2014

Moderators

We'd like to thank these amazing companies for supporting us

Your logo here?

Laravel.io

The Laravel portal for problem solving, knowledge sharing and community building.

© 2024 Laravel.io - All rights reserved.