Public livewire page in custom plugin

Hi, i'm making a custom plugin, this plugin is registered in the AdminPanel I need to have a full livewire page outside the panels, accessible to everyone the page in the end show a filament form, at the moment i have a livewire error Unable to find component: [register-tenant] route
Route::get('/register', [TenantRegistrationController::class, 'create'])->name('register.tenant');
Route::get('/register', [TenantRegistrationController::class, 'create'])->name('register.tenant');
controller
class TenantRegistrationController extends Controller
{
public function create()
{

return view('bossonboarding::register');
}
...
class TenantRegistrationController extends Controller
{
public function create()
{

return view('bossonboarding::register');
}
...
the view

<h1>Register</h1>

@livewire('register-tenant');

<h1>Register</h1>

@livewire('register-tenant');
the call to the livewire component cause
Unable to find component: [register-tenant]
Unable to find component: [register-tenant]
problem is HERE! this file is never called in src/Http/Livewire
<?php

namespace Base33\BossOnboarding;

use Livewire\Component;
use Illuminate\Contracts\View\View;

class RegisterTenant extends Component
{

public ?array $data = [];
public function mount(): void
{
dd('RegisterTenant component mounted!');
$this->data = [];
}

public function create(): void
{
dd('Form submitted', $this->data);
}

public function render(): View
{
dd('render');
return view('bossonboarding::livewire.register-tenant');
}
}
<?php

namespace Base33\BossOnboarding;

use Livewire\Component;
use Illuminate\Contracts\View\View;

class RegisterTenant extends Component
{

public ?array $data = [];
public function mount(): void
{
dd('RegisterTenant component mounted!');
$this->data = [];
}

public function create(): void
{
dd('Form submitted', $this->data);
}

public function render(): View
{
dd('render');
return view('bossonboarding::livewire.register-tenant');
}
}
the boot function in the plugin service provider
public function boot()
{
parent::boot();

// Register Livewire components
Livewire::component('register-tenant', RegisterTenant::class);
}
public function boot()
{
parent::boot();

// Register Livewire components
Livewire::component('register-tenant', RegisterTenant::class);
}
Solution:
i've found the solution this morning, wrong declaration this is right use Base33\BossOnboarding\Http\Livewire\RegisterTenant; but this use Base33\BossOnboarding\RegisterTenant; doesn't throw errors...
Jump to solution
2 Replies
Julien B. (aka yebor974)
Hi! It seems the issue is related to your Livewire component registration. - First, are you using the correct use statement for your component in the boot() method of your service provider? - It might also be a cache issue. Try running: php artisan cache:clear - Also, your service provider might only be loaded inside the Filament panel context, not in the public frontend. That depends on how you've registered it in your plugin's composer.json. Could you share the relevant part of your composer.json to confirm that?
Solution
Soundmit
Soundmit3mo ago
i've found the solution this morning, wrong declaration this is right use Base33\BossOnboarding\Http\Livewire\RegisterTenant; but this use Base33\BossOnboarding\RegisterTenant; doesn't throw errors

Did you find this page helpful?