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

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);
0

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.

0

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.

0

Sign in to participate in this thread!

Eventy

Your banner here too?

illmatic illmatic Joined 28 Sep 2015

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.