tenancy / multi-tenant

Run multiple websites using the same Laravel installation while keeping tenant specific data separated for fully independent multi-domain setups, previously github.com/hyn/multi-tenant
https://tenancy.dev
MIT License
2.56k stars 394 forks source link

Route name not working get ,post and put and delete method but resource route is working #1048

Open dibakar1990 opened 3 months ago

dibakar1990 commented 3 months ago

Multi tenant route issue

my tenant route is:

Route::middleware([
    'web',
    InitializeTenancyByDomain::class,

    PreventAccessFromCentralDomains::class,
])->group(function () {   

    Route::get('/', function () {
        return view('tenant.auth.login');
    });

    Route::middleware('auth')->group(function () {
        Route::resource('profile',ProfileController::class)->only('index','edit','update');
        Route::get('profile/setting',[ProfileController::class,'setting'])->name('profile.setting');
        Route::get('profile/change/password',[ProfileController::class,'setting'])->name('profile.change.password');
        Route::post('profile/update/password',[ProfileController::class,'setting'])->name('profile.update.password');

    });

    require __DIR__ . '/tenant-auth.php';
});

i have used route name {{ route('profile.setting') }}

<a href="{{ route('profile.setting') }}">
  <em class="icon ni ni-lock-alt-fill"></em>
  <span>Security Settings</span>
</a>

Screenshot from 2024-08-23 17-28-48

Route [profile.setting] not defined.

Fenanders commented 1 month ago

could you verify first the route? ensure that the auth middleware is not blocking access to those named routes. You can add a simple test route without auth middleware to verify:

Route::get('test-route', [ProfileController::class, 'test'])->name('profile.test');

Then try to access it via {{ route('profile.test') }} and see if it's correctly resolved.