rabol
rabol
FFilament
Created by rabol on 10/2/2024 in #❓┊help
How can I avoid pest tests failing if I install frontend panel with the id dashboard
Install a new Laravel app, with Jetstream as the starterkit and pest. Install Filament and create a new panel for the users dashboard. First run php artisan test and make sure that all tests are passing then
artisan make:filament-panel dashboard
artisan make:filament-panel dashboard
for the dashboard to work, you have to remove the 'jetstream' dashboard route from your web.php, then you have to modify a few view's then run
php artisan test
php artisan test
and 2-3 test will fail is there a recommend way to avoid this ?
7 replies
FFilament
Created by rabol on 9/15/2024 in #❓┊help
Filament::getPanel('dashboard')->getUrl() returns the wrong url
I have a laravel app, based on JetStream, I have two panels, Admin and Dashboard in my
resources/navigation-menu.blade.php
resources/navigation-menu.blade.php
I have this:
<!-- Logo -->
<div class="shrink-0 flex items-center">
<a href="{{ Filament::getPanel('dashboard')->getUrl() }}">
<x-application-mark class="block h-9 w-auto"/>
</a>
</div>
<!-- Logo -->
<div class="shrink-0 flex items-center">
<a href="{{ Filament::getPanel('dashboard')->getUrl() }}">
<x-application-mark class="block h-9 w-auto"/>
</a>
</div>
but.... the url is mysite.test/admin and not mysite.test/dashboard if I then create a simple view like this:
@php
use Filament\Facades\Filament;
@endphp

<x-app-layout>
<x-slot name="header">
<h2 class="font-semibold text-xl text-gray-800 dark:text-gray-200 leading-tight">
{{ __('Simple') }}
</h2>
</x-slot>

<div class="py-12">
<div class="max-w-7xl mx-auto sm:px-6 lg:px-8">
<div class="bg-white dark:bg-gray-800 overflow-hidden shadow-xl sm:rounded-lg">
<a href="{{ Filament::getPanel('dashboard')->getUrl() }}">dashboard</a>
</div>
</div>
</div>
</x-app-layout>
@php
use Filament\Facades\Filament;
@endphp

<x-app-layout>
<x-slot name="header">
<h2 class="font-semibold text-xl text-gray-800 dark:text-gray-200 leading-tight">
{{ __('Simple') }}
</h2>
</x-slot>

<div class="py-12">
<div class="max-w-7xl mx-auto sm:px-6 lg:px-8">
<div class="bg-white dark:bg-gray-800 overflow-hidden shadow-xl sm:rounded-lg">
<a href="{{ Filament::getPanel('dashboard')->getUrl() }}">dashboard</a>
</div>
</div>
</div>
</x-app-layout>
the url is ok in the view but not in the menu
4 replies
FFilament
Created by rabol on 9/2/2024 in #❓┊help
Why does getModelLabel change my text ?
If I understand it correctly, then resource::getLabel() is deprecated, and one should use resource::getModelLabel(). But... why does filament change the text that I return to plural ?
public static function getModelLabel(): string
{
return __('Block field');
}
public static function getModelLabel(): string
{
return __('Block field');
}
become 'Block fields'
4 replies
FFilament
Created by rabol on 7/25/2024 in #❓┊help
How to get row actions as a menu instead of links
Hi Is there an easy way to 'group' all row actions into a 'drop-down'?
16 replies
FFilament
Created by rabol on 6/14/2024 in #❓┊help
Is it possible to make the toggle column dropdown scrollable?
No description
7 replies
FFilament
Created by rabol on 5/9/2024 in #❓┊help
TypeError on resource where column is an Enum
I have a User Model, and did like this: php artisan make:filament-resource UserResource -G
and when I try to view the users i get this:
Filament\Tables\Columns\TextColumn::Filament\Tables\Columns\Concerns\{closure}(): Return value must be of type ?string, App\Enums\UserLevelEnum returned
Filament\Tables\Columns\TextColumn::Filament\Tables\Columns\Concerns\{closure}(): Return value must be of type ?string, App\Enums\UserLevelEnum returned
I get it even if I remove the column that uses enum the enum:
enum UserLevelEnum: int implements HasLabel
{
---
}
enum UserLevelEnum: int implements HasLabel
{
---
}
What am I missing ?
26 replies
FFilament
Created by rabol on 3/28/2024 in #❓┊help
is there a 'before the create button is clicked hook'
It might not be a big issue, but I just discovered that in one have a upload comonemt in a form e.g. like this:
Forms\Components\FileUpload::make('thumbnail')
->disk(config('filesystems.default'))
->directory('articles')
->visibility('public')
->image()
->imageEditor()
->imageEditorAspectRatios([
'16:9',
'4:3',
'1:1',
])
->required(),
Forms\Components\FileUpload::make('thumbnail')
->disk(config('filesystems.default'))
->directory('articles')
->visibility('public')
->image()
->imageEditor()
->imageEditorAspectRatios([
'16:9',
'4:3',
'1:1',
])
->required(),
while this works it will give issues in some cases where the 'filesystems.default' is set to 'local' or if the the configuration does not have a 'url' key, in that case it would be nice to be able to do some validation even before allowing the user to create a new record. I know that there is beforValidate() and beforCreate(), but in this case the user has already entered some information in the form is there a way to do something just before the create button is pressed ?
2 replies
FFilament
Created by rabol on 3/22/2024 in #❓┊help
How can I always use the App login page and never the Filament login page
Hi Is there a way to make sure that the 'normal' login page is always used instead of the Filament login page ? I have tried to add
->loginRouteSlug('login')
->loginRouteSlug('login')
in the AdminPanelProvider but when trying to access /admin it redirect to admin/login and show the Filament login page
4 replies
FFilament
Created by rabol on 3/18/2024 in #❓┊help
confirm dialog looks strange
No description
5 replies
FFilament
Created by rabol on 11/3/2023 in #❓┊help
how do I get the active locale to be used in a translatable select
I have a translatable resource and this resource have a belongsTo relationship to another translatable resource Both resources are created with the -S option FaqCategory and Faq ar both translatable When creating a new Faq, I have this:
public static function form(Form $form): Form
{
return $form
->schema([
Forms\Components\TextInput::make('title')
->required(),
Forms\Components\TextInput::make('body')
->required(),
Forms\Components\Select::make('faq_category_id')
->relationship(name: 'category', titleAttribute: 'name->en'),
]);
}
public static function form(Form $form): Form
{
return $form
->schema([
Forms\Components\TextInput::make('title')
->required(),
Forms\Components\TextInput::make('body')
->required(),
Forms\Components\Select::make('faq_category_id')
->relationship(name: 'category', titleAttribute: 'name->en'),
]);
}
It works, but I always get the 'English' name in the select I can see that the trait on the
ManageFaqs
ManageFaqs
has a getActiveTableLocale(), but as it's not a static methodI cannot call that in my resource, so how do I get the active locale
2 replies
FFilament
Created by rabol on 11/3/2023 in #❓┊help
does filament-spatie-translatable work when the resource is generated with -S option
For a FAQ 'module' I'm trying to use the https://filamentphp.com/plugins/filament-spatie-translatable plugin, I have added the plugin to the panel. I then generated the resource
php artisan make:filament-resource FaqCategory -G -S
php artisan make:filament-resource FaqCategory -G -S
I have added the
use Translatable;
use Translatable;
to the resource but the create and editdoes not have controls for the translations
6 replies
FFilament
Created by rabol on 9/26/2023 in #❓┊help
Link in admin panel
Hi In V2, the link in the upper left corner of the panel was going to the frontend, but now it goes to /admin Is there a way to get the 'old' function back ?
7 replies
FFilament
Created by rabol on 9/25/2023 in #❓┊help
Problems pasing parameters to pages in a plugin
I'm having trouble to pass parameters to a page my log viewer plugin. I'm using Sushi as my 'record' so I cannot have a normal Filament resource I have 3 pages the main page that list the log files - works, no problem the log file page that lists the entries in the log file - some how it works the log file entry page that shows details of a log entry - does not work at all all 3 pages is registered in the plugin like this:
public function register(Panel $panel): void
{

$panel
->pages([
LogViewerPage::class,
LogViewerViewLogPage::class,
LogViewerViewDetailsPage::class,
]);
}
public function register(Panel $panel): void
{

$panel
->pages([
LogViewerPage::class,
LogViewerViewLogPage::class,
LogViewerViewDetailsPage::class,
]);
}
In LogViewerPage I have a table, and this is how I generate the actions
protected function getTableActions(): array
{
return [

Tables\Actions\Action::make('viewlogfile')
->label('View')
->url(function (LogFile $record) {
return LogViewerViewLogPage::getUrl(['fileName' => $record->name]);
}),

Tables\Actions\Action::make('delete')
->action('deleteLogFile')
->requiresConfirmation()
->hidden(fn ($record) => ! static::canDelete($record)),

];
}
protected function getTableActions(): array
{
return [

Tables\Actions\Action::make('viewlogfile')
->label('View')
->url(function (LogFile $record) {
return LogViewerViewLogPage::getUrl(['fileName' => $record->name]);
}),

Tables\Actions\Action::make('delete')
->action('deleteLogFile')
->requiresConfirmation()
->hidden(fn ($record) => ! static::canDelete($record)),

];
}
in LogViewerViewLogPage the mount() throws an error Unable to resolve dependency [Parameter #0 [ <required> $fileName ]] in class Rabol\FilamentLogviewer\Pages\LogViewerViewLogPage the url looks like this:
/admin/log-viewer-view-log-page?fileName=worker.log
/admin/log-viewer-view-log-page?fileName=worker.log
public function mount($fileName): void
{
$this->log = LogReader::filename($fileName);
$this->logEntries = $this->log->get(); // we need to paginate...
self::$title = 'Log file: '.$fileName;
$this->fileName = $fileName;
}
public function mount($fileName): void
{
$this->log = LogReader::filename($fileName);
$this->logEntries = $this->log->get(); // we need to paginate...
self::$title = 'Log file: '.$fileName;
$this->fileName = $fileName;
}
any hint on what I'm missing ?
15 replies
FFilament
Created by rabol on 9/25/2023 in #❓┊help
routes in plugin
How do I register routes for pages in a plugin ?
4 replies
FFilament
Created by rabol on 9/25/2023 in #❓┊help
plugin upgrade
Hi I'm trying to upgrade my filament-logviewer plugin I have used the 'skeleton' plugin (did you check the skeleton https://github.com/filamentphp/plugin-skeleton) The plugin get's installed, but it does not show up in the admin panel automatically I'm sure I missed something, but not really sure what
8 replies
FFilament
Created by rabol on 9/21/2023 in #❓┊help
how to make the list page take up the full with
Hi How can I get the the ListPage of a resource take up the full with ?
6 replies
FFilament
Created by rabol on 8/24/2023 in #❓┊help
Getting 404 when loading assets
Hi My Filament admin panel has been working for some time, but just today I get a 404 when loading the assets If i try to access the assets directly https://xxxx/filament/assets/app.css?id=ceb9a486dfc44ebe8adaa3bd510821e8 I get the the css but when loading the panel the css is not loaded and in the console I can see 404 errors Yes, I have found other discussions here and it does not solve my issue
60 replies
FFilament
Created by rabol on 7/31/2023 in #❓┊help
acceptedFileTypes reject valid file types
I have this on a Fileupload:
->acceptedFileTypes(['application/json', 'json', 'application/msword', 'docx'])
->acceptedFileTypes(['application/json', 'json', 'application/msword', 'docx'])
I have tried this as well:
->acceptedFileTypes(['docx'])
->acceptedFileTypes(['docx'])
but when I select a .docx file I get an error saying: 'File of invalid type'
22 replies
FFilament
Created by rabol on 7/18/2023 in #❓┊help
How do I get the file in a upload action
on a resource page I have an action:
Tables\Actions\Action::make('import')
->form([
Forms\Components\FileUpload::make('file'),
])
->label('')
->tooltip('Import')
->icon('heroicon-o-folder-open')
->action('import'),
Tables\Actions\Action::make('import')
->form([
Forms\Components\FileUpload::make('file'),
])
->label('')
->tooltip('Import')
->icon('heroicon-o-folder-open')
->action('import'),
shows a modal, one can upload a file and it call my 'import' method. But... what parameters do I get in my method? I would lige to get the current record and then the fileupload so that I can 'import' the data in this case
public function import($record, $file)
{

dd($record, $file);
}
public function import($record, $file)
{

dd($record, $file);
}
Does not work
10 replies
FFilament
Created by rabol on 7/3/2023 in #❓┊help
getFormSchema is called on every 'next' in a wizard
Hi it looks like the getFormSchema is called every time you press next in a wizard. First I saw that it was taking a very long time when pressing the 'next', so I started to investigate Here is a simple wizard that shows the error:
19 replies