Skip to content

Identification by Path + Livewire Login Component #628

@ghost

Description

Describe the bug

I tried to make it work with Identification by Path and a Livewire Login Component. But it keeps showing a message like this: Stancl\Tenancy\Exceptions\RouteIsMissingTenantParameterException The route's first argument is not the tenant id (configured paramter name: tenant).

Steps to reproduce

I already declared the middleware at livewire config:

    'middleware_group' => [
        'web',
        \Stancl\Tenancy\Middleware\InitializeTenancyByPath::class,
    ],

And in routes/tenant.php

Route::prefix('/{tenant}')
    ->middleware([
        'web',
        \Stancl\Tenancy\Middleware\InitializeTenancyByPath::class,
    ])->group(function () {
Route::get('/login', Login::class);
});

My livewire fullpage component:


namespace App\Http\Livewire;

use Livewire\Component;

class Login extends Component
{
    public $form = [
        'email' => null,
        'password' => null,
        'remember' => false,
    ];

    public function render()
    {
        return view('livewire.login');
    }

    public function submit()
    {
     
        $isSuccess = auth()->attempt([
            'email' => $this->form['email'],
            'password' => $this->form['password']
        ], $this->form['remember']);

    }
}

And then i created a tenant with the name test and access to it via mydomain.com/test, when i submitted the form it got the error like descripted

Expected behavior

If i using idenfication by domains, i will work normally. But i don't want to use domains for some reasons.

Your setup

  • Laravel version: 8.34.0
  • stancl/tenancy version: 3.4.2

Metadata

Metadata

Assignees

Labels

bugSomething isn't working

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions