sidrit
sidrit
FFilament
Created by sidrit on 4/3/2024 in #❓┊help
ReferenceError: selectedRows is not defined
No description
8 replies
FFilament
Created by sidrit on 3/22/2024 in #❓┊help
Redirect on HTTP Client exception
I'm trying to wrap my head around something here. I have a filament page (a custom one) with an Infolist. The infolist is used to display some data that is fetched remotely from another application. I set it all up with ->state($this->record->someMethod()). Works great. I'm trying to handle the cases where the underlying http request (made with Laravel's HTTP Client) may fail. I throw an exception (with ->throwIf()) and the client will throw a RequestException. I'm trying to catch this one in the Handler and the idea is to log the user out (seems counter-intuitive but it's a specification) and redirect the user to the /login page, In the Handler though the exception seems to be wrapped in a Spatie\LaravelIgnition\Exceptions\ViewException In a plain Laravel application this would work
$this->reportable(function (Throwable $e) {
if(($e instanceof ViewException && $e->getPrevious() instanceof RequestException) || $e instanceof RequestException) {
auth()->logout();
return redirect()->route('login');
}
});
$this->reportable(function (Throwable $e) {
if(($e instanceof ViewException && $e->getPrevious() instanceof RequestException) || $e instanceof RequestException) {
auth()->logout();
return redirect()->route('login');
}
});
and the user will be redirected but the returned redirect here it seems stuck somethere in the Livewire layers. Additionally if i try to make it renderable
$this->renderable(function (Throwable $e) {
if(($e instanceof ViewException && $e->getPrevious() instanceof RequestException) || $e instanceof RequestException) {
auth()->logout();
return redirect()->route('login');
}
});

$this->renderable(function (Throwable $e) {
if(($e instanceof ViewException && $e->getPrevious() instanceof RequestException) || $e instanceof RequestException) {
auth()->logout();
return redirect()->route('login');
}
});

I am getting Undefined property: Livewire\Features\SupportRedirects\Redirector::$headers Am i missing something obvious here? What's the recommended Filament way to handle exceptions/redirect?
4 replies
FFilament
Created by sidrit on 3/16/2024 in #❓┊help
Listening for broadcast events
Hi folks Been working with filament for a little bit now and really enjoying it. I’ve been building with Laravel since v4 now and really liking the productivity bump. Anyhow there’s something I’m trying to wrap my head around on how to do “the filament way”. Let’s assume I have a component (TextEntry, TextColumn etc). For that specific item I know while displaying it, I will be receiving a broadcast notification (say for example a list of processes running in the background and when the state of any changes, I fire an event) Now this would be no mystery with just Laravel using Broastasting + echo. Even in Livewire (which I’ve been using for a long time) it would not be an issue (setting up listeners to subscribe to Echo) How would I got about doing this with one of the filament pages? (Say View or List page) Would it be a custom page treated like a regular Livewire component? Is maybe a custom Field or custom Entry? Receiving these live updates (considering we have everything in the ecosystem even with Reverb coming out) seems like a common scenario but I can’t find a proper information on it Thanks in advance to anyone that could help shed some light
40 replies