Search code examples
laravel-8laravel-livewire

issue with redirecting with livewire component


I am using laravel-8 with livewire in which I have made service module and I want to redirect on another page while click on create button for that I have make below code

<button wire:click="create()" class="bg-blue-500 hover:bg-blue-700 text-white font-bold py-2 px-4 rounded my-3">Create New Service</button>
//with route

use App\Http\Livewire\Service\Service;
Route::get('service', Service::class);


public function render()
{
    $this->service = ServiceModel::all();
    return view('livewire.service.service');
}


public function create()
{
    $this->category = CategoryModel::all();
    return view('livewire.service.create');
}

but it is not redirect on that page

can anybody help me in this


Solution

  • It should work if you call the method by name, but without the function call:

    <button wire:click="create">