I should also add that I'm using Resource model binding where I have the following defined in my RouteServiceProvider
Route::model('User', App\User::class);
Route::model('Template', App\Template::class);
Route::model('Account', App\Account::class);
OK looks like Landlord doesn't play nice with Route Model Binding and simply have to change my Controller methods from
public function show(Account $account)
to
public function show($id) {
$account = Account::findOrFail($id);
The only new problem now is that it doesn't seem to be working with nested routes.
If I have Route::resource('account.template', 'TemplateController')
but then try and authenticate the user_id on the account the same way i do in my AccountController, it doesn't append the tenant check.
If the parent is Tenant Scoped, and the child is referenced on a foreign key, the Scope is not required.
As the child is anyways bound directly to the parent (Account), and you'd "always" access the (Template) from the Account, through the relationship.
Sign in to participate in this thread!
The Laravel portal for problem solving, knowledge sharing and community building.
The community