Closed meta0102 closed 6 years ago
i fixed this issue by adding
Landlord::applyTenantScopes(Auth::user());
to my middleware
class ScopeCompany
{
public function handle($request, Closure $next)
{
if (Auth::check()) {
$companyId = Auth::user()->company_id;
if($companyId != null) {
Landlord::addTenant('company_id', $companyId);
Landlord::applyTenantScopes(Auth::user());
}
}
return $next($request);
}
}
Thank you @meta0102 this also works for me!
@HipsterJazzbo Maybe the documentation should be updated how to setup this package correctly? 😄
hi, i know that there is already an closed issue with the same behavior. no solution is working for me.
Tenant is working on all Models except the User model.
Middleware applied in route
Kernel.php (i've also tried to add the Middleware to the $middleware or api group, same result)
Middleware:
User Model:
thanks for any help!