LiveWire Redirect

I have a menuitem which invokes a livewire component. That component does some logic and redirects them back to the main dashboard. The redirect is not working, not sure what the issue is.
<?php

namespace App\Livewire;

use Illuminate\Support\Facades\Log;
use Illuminate\Support\Facades\Redirect;
use Livewire\Component;

class SwitchTeam extends Component
{
public $tenant;
public $team;
public function store() {
Log::info($this->tenant . " - " . $this->team);

}

public function render()
{

Log::info($this->tenant . " - " . $this->team);

// Other Logic ....

return $this->redirect(route('filament.app.pages.dashboard', ['tenant' => $this->tenant]));
}
}
<?php

namespace App\Livewire;

use Illuminate\Support\Facades\Log;
use Illuminate\Support\Facades\Redirect;
use Livewire\Component;

class SwitchTeam extends Component
{
public $tenant;
public $team;
public function store() {
Log::info($this->tenant . " - " . $this->team);

}

public function render()
{

Log::info($this->tenant . " - " . $this->team);

// Other Logic ....

return $this->redirect(route('filament.app.pages.dashboard', ['tenant' => $this->tenant]));
}
}
Not sure if there is a better way to invoke a livewire component or specific method from an MenuItem. Ultimately I need to invoke some logic from a menuitem. I believe this is a issue with redirects in the render method. However I am at a loss to understand the best way to accomplish this.
2 Replies
darcy1368
darcy1368OP10mo ago
Solved this using a controler, but it breaks my spa. Still interested in a better solution if anyone has an idea.
SirAlyon
SirAlyon10mo ago
In my project im redirect back with something like: return redirect()->route('my-route'); And is working fine (filament notification after the redirect too)
Want results from more Discord servers?
Add your server