johncarter
johncarter
FFilament
Created by johncarter on 9/18/2024 in #❓┊help
Why is my register page always redirecting to `/users`?
What I am trying to do: Redirect users to my main dashboard page after registering. What I did:
return $panel
->default()
->id('app')
->path('/')
->registration(Register::class)
// ...
return $panel
->default()
->id('app')
->path('/')
->registration(Register::class)
// ...
My issue/the error: When logging in users get redirected to /users and I don't understand why. The UserResource has the following restriction:
public static function canAccess(): bool
{
return auth()->user()->role !== 'Patient';
}
public static function canAccess(): bool
{
return auth()->user()->role !== 'Patient';
}
Logging the Filament::getUrl() in the default RegistrationResponse returns https://myappname.uk/users
13 replies
FFilament
Created by johncarter on 3/22/2024 in #❓┊help
Using panel form actions in custom form
I have a custom page in a panel and I want to use the standard panel form view for my form and form actions. Is there a way for me to use the panel view within a custom page and set the actions using getFormActions() rather than having to have protected static string $view = 'filament.pages.my-custom-form';?
2 replies
FFilament
Created by johncarter on 2/29/2024 in #❓┊help
Can I render a custom 403 page within the context of a panel?
The default 403 is a bit jarring to look at when you are navigating around a panel.Is there a way I can render a 403 within the context of a panel? I basically just want the panel layout, or even just the panels custom theme CSS to be available in errors/403.blade.php. I tried using a panel components like <x-filament-panels:layout.base> but they are all are missing their class methods / context.
3 replies
FFilament
Created by johncarter on 2/15/2024 in #❓┊help
What is the "Filament way" of showing a dismissible alert
No description
11 replies
FFilament
Created by johncarter on 1/30/2024 in #❓┊help
Action button not updating with `isProcessing`
I have a panel where I am displaying a custom Livewire component that has a table and action. But the action doesn't react to the isProcessing alpine prop that is toggled on when a file is uploading.
public function form(Form $form): Form
{
return $form
->schema([
Section::make()
->maxWidth('lg')
->schema([
Placeholder::make('')
->content('You must register a business to you the website.'),
TextInput::make('name')
->label('Business name')
->autofocus()
->unique(Company::class, 'name')
->required()
->minLength(3),
FileUpload::make('logo')
->label('Business logo')
->extraAttributes(['class' => 'max-w-[18rem]'])
->image(),
])
])
->statePath('data');
}

public function getFormActions(): array
{
return [
Action::make('submit')
->action(function () {
Company::create($this->form->getState());

redirect(Dashboard::getUrl());
})
->label('Register business')
];
}
public function form(Form $form): Form
{
return $form
->schema([
Section::make()
->maxWidth('lg')
->schema([
Placeholder::make('')
->content('You must register a business to you the website.'),
TextInput::make('name')
->label('Business name')
->autofocus()
->unique(Company::class, 'name')
->required()
->minLength(3),
FileUpload::make('logo')
->label('Business logo')
->extraAttributes(['class' => 'max-w-[18rem]'])
->image(),
])
])
->statePath('data');
}

public function getFormActions(): array
{
return [
Action::make('submit')
->action(function () {
Company::create($this->form->getState());

redirect(Dashboard::getUrl());
})
->label('Register business')
];
}
<x-filament-panels::page>
<x-filament-panels::form
:wire:key="$this->getId() . '.forms.' . $this->getFormStatePath()"
wire:submit="create">
{{ $this->form }}

<x-filament-panels::form.actions
:actions="$this->getCachedFormActions()"
:full-width="$this->hasFullWidthFormActions()" />
</x-filament-panels::form>
</x-filament-panels::page>
<x-filament-panels::page>
<x-filament-panels::form
:wire:key="$this->getId() . '.forms.' . $this->getFormStatePath()"
wire:submit="create">
{{ $this->form }}

<x-filament-panels::form.actions
:actions="$this->getCachedFormActions()"
:full-width="$this->hasFullWidthFormActions()" />
</x-filament-panels::form>
</x-filament-panels::page>
2 replies
FFilament
Created by johncarter on 10/2/2023 in #❓┊help
Is it possible to render a table component inside a form component?
I want to render a table of model records that use the selected rows to save a relationship. A relation manager doesn't work because i want to show a table of all possible records that i can attach to, not a searchable select with a table that shows existing relationships.
Any ideas?
5 replies
FFilament
Created by johncarter on 9/29/2023 in #❓┊help
Make Relation Manager reactive?
I would like to alter the query that a relationship manager uses based on the user input on a form. Is that possible? I have seen https://filamentphp.com/docs/3.x/panels/resources/relation-managers#passing-properties-to-relation-managers but I am unclear on how I pass these dynamically. I'd appreciate any help.
2 replies
FFilament
Created by johncarter on 8/1/2023 in #❓┊help
How do I redirect a user after login based on the panel they are allowed to view?
I have 2 panels:
class CpPanelProvider extends PanelProvider
{
public function panel(Panel $panel): Panel
{
return $panel
->default()
->id('cp')
->path('cp')
//...
class CpPanelProvider extends PanelProvider
{
public function panel(Panel $panel): Panel
{
return $panel
->default()
->id('cp')
->path('cp')
//...
class FrontendPanelProvider extends PanelProvider
{
public function panel(Panel $panel): Panel
{
return $panel
->id('frontend')
->path('')
class FrontendPanelProvider extends PanelProvider
{
public function panel(Panel $panel): Panel
{
return $panel
->id('frontend')
->path('')
I want to say, if you can view the Cp then redirect there, else redirect to the frontend. I have this in app/Http/Responses/LoginResponse.php
class LoginResponse implements LoginResponseContract
{
public function toResponse($request)
{
return auth()->user()->canAccessPanel('TODO') ? 'TODO' : 'TODO';
}
}
class LoginResponse implements LoginResponseContract
{
public function toResponse($request)
{
return auth()->user()->canAccessPanel('TODO') ? 'TODO' : 'TODO';
}
}
6 replies
FFilament
Created by johncarter on 5/27/2023 in #❓┊help
How do make links in `RichEditor` `nofollow`?
As the title suggests, is there a way to conditionally make some links have the attribute rel="nofollow"?
4 replies
FFilament
Created by johncarter on 3/10/2023 in #❓┊help
Reposition default page buttons
How do I reposition the default Save/Create buttons in a resource page? Ideally within a Card component but at the top right would also be fine.
13 replies