pace
pace
FFilament
Created by pace on 10/8/2024 in #❓┊help
It's possible change the "default title" for all tabs?
Currently filament show the (of the tab) title using this code in layout/base.blade.php:
@php
$title = trim(strip_tags(($livewire ?? null)?->getTitle() ?? ''));
$brandName = trim(strip_tags(filament()->getBrandName()));
@endphp

<title>
{{ filled($title) ? "{$title} - " : null }} {{ $brandName }}
</title>
@php
$title = trim(strip_tags(($livewire ?? null)?->getTitle() ?? ''));
$brandName = trim(strip_tags(filament()->getBrandName()));
@endphp

<title>
{{ filled($title) ? "{$title} - " : null }} {{ $brandName }}
</title>
But I need to change that and show the brandname before:
{{ $brandName }} - {{ filled($title) ? "{$title} " : null }}
{{ $brandName }} - {{ filled($title) ? "{$title} " : null }}
How can I change ( in a safe way ) this file? I can create some view to override? Or have another solution? But I don't think override the base file is a good idea.
3 replies
FFilament
Created by pace on 10/7/2024 in #❓┊help
It's possible change the <title> of the page without change the dashboard title
No description
7 replies
FFilament
Created by pace on 8/19/2024 in #❓┊help
How to enforce ->viteTheme to use https?
No description
10 replies
FFilament
Created by pace on 8/12/2024 in #❓┊help
Handling Users with No Permissions
I am using Filament Shield to allow the admin to manage user roles and permissions. However, after login, if a user doesn't have permission to access any resources, no 403 error message is displayed, and the user is redirected in an infinite loop to /admin. What I want to achieve is to show a 403 error page when the user doesn't have permission to access any resources. I attempted to create a middleware to check if the user has access to any menu items:
public function handle(Request $request, Closure $next)
{
if (auth()->user()) {
$navigationManager = new NavigationManager;
$navigation = $navigationManager->getNavigationItems();

if (empty($navigation)) {
abort(403, 'No navigation items are available for the authenticated user. Please contact the system administrator.');
}
}

return $next($request);
}
public function handle(Request $request, Closure $next)
{
if (auth()->user()) {
$navigationManager = new NavigationManager;
$navigation = $navigationManager->getNavigationItems();

if (empty($navigation)) {
abort(403, 'No navigation items are available for the authenticated user. Please contact the system administrator.');
}
}

return $next($request);
}
However, when this middleware is invoked, the NavigationManager doesn’t return any items, regardless of the user's permissions. It seems that the NavigationManager might not be booted or loaded at this point. How can I ensure the navigation items are loaded before the middleware runs? Or is there another solution to handle this issue? Any advice would be greatly appreciated. Thanks!
2 replies
FFilament
Created by pace on 5/14/2024 in #❓┊help
How to use a parameter to change a resource table query?
I am working with : FolderResource and AccessLinkResource. An AccessLink belongs to an Folder. And Folderhave many AccessLinks. I am trying to create a AccessLinkResource which show and create the records using the folder_id. The first step is filter the records of AccessLinkResource table using the folder_id. To do that, i created a button in FolderResource:
Tables\Actions\ViewAction::make('accessLink'))
->url(fn(Folder $record): string => url(AccessLinkResource::getUrl('index', ['folder_id' => $record->id]))),
Tables\Actions\ViewAction::make('accessLink'))
->url(fn(Folder $record): string => url(AccessLinkResource::getUrl('index', ['folder_id' => $record->id]))),
And i used the modifyQueryUsing in AccessLinktable:
->modifyQueryUsing(function (Builder $query) {
$folderId = Request::query('folder_id');
$query->where('folder_id', $folderId);
});
->modifyQueryUsing(function (Builder $query) {
$folderId = Request::query('folder_id');
$query->where('folder_id', $folderId);
});
It works in the first load of the page, but when use the pagination return no records. What it is the correct way to handle this? How can I use the $folder_id param in a static method?
3 replies
FFilament
Created by pace on 3/20/2024 in #❓┊help
Trying to test a form but error: Attempt to read property "form" on null
I am following the docs and i tried to test a form with this code ( PHPUnit ): use App\Filament\Resources\UserResource\Pages\CreateUser; use Livewire\Livewire; public function test_if_valid_user_can_create_user(): void { $newData = User::factory()->make(); Livewire::test(CreateUser::class) ->fillForm([ 'name' => $newData->name, 'email' => $newData->email, 'password' => 'password', 'password_confirmation' => 'password', ]) ->call('create') ->assertHasNoErrors(); } But it is returning the error: Attempt to read property "form" on null. Is this livewire/livewire import right?
3 replies
FFilament
Created by pace on 3/6/2024 in #❓┊help
Use fa-icon in table builder
I'm working in a project who already have a database in production. The database have a table with a column called icon. The icon column have values like: <i class="fas fa-hard-hat"></i> I need to span this icons in a table. It's possible do that? Because when i tried to add ->html() to the TextForm, the cell become empty. I already tried to install the owenvoke/blade-fontawesome package
2 replies
FFilament
Created by pace on 3/6/2024 in #❓┊help
It's possible to put the relation on top of form page?
I have a big form. After create a record ( with doesn't have the relation fields already ), a user doesn't notice the fields in bottom of the form. Its possible to put the relation manager form before the "main" form?
1 replies