Algorithm
Algorithm
FFilament
Created by Algorithm on 1/30/2024 in #❓┊help
aftersave() hook method triggered three times when I edit a record.
protected function afterSave() { Log::info('testing'); } this is the log: [2024-01-30 09:37:13] local.INFO: testing
[2024-01-30 09:37:13] local.INFO: testing
[2024-01-30 09:37:13] local.INFO: testing
1 replies
FFilament
Created by Algorithm on 1/22/2024 in #❓┊help
FileUpload doesn't accept MorphTo.
This is the product model: public function photo(): MorphOne { return $this->morphOne(Photo::class, 'photoable'); } This is the photo model: public function photoable(): MorphTo { return $this->morphTo(); } This is the resource: FileUpload::make('photo') ->image() ->placeholder(__('Photo')), When I upload then the photo table is empty.
5 replies
FFilament
Created by Algorithm on 1/17/2024 in #❓┊help
Custom page and spatie translatable
I searched spatie translatable plugin and they didn’t mention on how to use this plugin in custom pages. So I was wondering how can I use this plugin in custom pages.
7 replies
FFilament
Created by Algorithm on 8/3/2023 in #❓┊help
Show Edit page instead of List when page is opened
Now when I click on a page in Navbar it goes to the list page is it possbile to goto the edit page instead of list page by default.
4 replies
FFilament
Created by Algorithm on 7/20/2023 in #❓┊help
Change the language of Select Component
I have a form and that form has a Select component that has relationship with department table. The problem that I faced is that when I change the language in create then select data stays in the same language and doesn't change. I use Spatie/Translatable plugin. The component with relationship is:
Forms\Components\Select::make('department')
->relationship('department', 'name')
->preload()
Forms\Components\Select::make('department')
->relationship('department', 'name')
->preload()
Department Model:
use HasTranslations;

public $translatable = [
'name'
];

protected $fillable = [
'name'
];
use HasTranslations;

public $translatable = [
'name'
];

protected $fillable = [
'name'
];
CreateJob.php
use CreateRecord\Concerns\Translatable;

protected static string $resource = JobResource::class;

protected function getActions(): array
{
return [
Actions\LocaleSwitcher::make(),
];
}
use CreateRecord\Concerns\Translatable;

protected static string $resource = JobResource::class;

protected function getActions(): array
{
return [
Actions\LocaleSwitcher::make(),
];
}
Thank you.
11 replies