Landlord: BelongsToTenant not working on user model

Hey Guys,

everything works fine: If I query with Model::find(123) on my model and the resource does not belong to the current tenant (set via middleware) the request fails.

But: If I query on the User model it does not work. While asking for User::all() I get really all results including other customers and while querying User::findOrFail() with an ID which does not belong to the current tenant I get the result … so everytime working with my user model I have to check if $model->tenant_id == $request->user()->tenant_id

About this issue

  • Original URL
  • State: closed
  • Created 8 years ago
  • Comments: 22 (7 by maintainers)

Most upvoted comments

@patroniton I was accidentally still checkin the DB for the tenant_id, instead of of the subdomain, which I didn’t realise before now, doh.