Davide Cariola
Davide Cariola
FFilament
Created by Davide Cariola on 2/19/2025 in #❓┊help
CreateAction in Custom Page doesn't show form
Hi guys, thank you so much! I've tried to use the form() function before but not in the right way. For future reference to others, this is the solution:
protected function getHeaderActions(): array
{
return [
CreateAction::make()
->model(NoteResource::getModel())
->form(fn(Form $form) => NoteResource::form($form)),
];
}
protected function getHeaderActions(): array
{
return [
CreateAction::make()
->model(NoteResource::getModel())
->form(fn(Form $form) => NoteResource::form($form)),
];
}
6 replies
FFilament
Created by Davide Cariola on 8/12/2024 in #❓┊help
Using a FileUpload input in a Custom Page
I was navigating on 127.0.0.1:0000 and not in localhost:8000 as my APP_URL... Well, at least now it works 😄 Thank you so much for your help Ed!
16 replies
FFilament
Created by Davide Cariola on 8/12/2024 in #❓┊help
Using a FileUpload input in a Custom Page
It's already like that. Other fileupload inputs work as intended 🤔 Instead this one is in a custom page
16 replies
FFilament
Created by Davide Cariola on 8/12/2024 in #❓┊help
Using a FileUpload input in a Custom Page
Locally, in Storage
16 replies
FFilament
Created by Davide Cariola on 8/12/2024 in #❓┊help
Using a FileUpload input in a Custom Page
No description
16 replies
FFilament
Created by Davide Cariola on 8/12/2024 in #❓┊help
Using a FileUpload input in a Custom Page
Hi Ed, thank you for your reply. It returns a path:
"cover" => "public/briefImage/KyzIWU8hnDQQdrlWGqI9PMAwFGh9oiCd4TVhSJqj.jpg"
"cover" => "public/briefImage/KyzIWU8hnDQQdrlWGqI9PMAwFGh9oiCd4TVhSJqj.jpg"
If I use the Storage:url() method, which returns:
"cover" => "/storage/briefImage/KyzIWU8hnDQQdrlWGqI9PMAwFGh9oiCd4TVhSJqj.jpg"
"cover" => "/storage/briefImage/KyzIWU8hnDQQdrlWGqI9PMAwFGh9oiCd4TVhSJqj.jpg"
I have the same results. The other fields (cover_alt_text and credits_text) work as a charm
16 replies
FFilament
Created by Davide Cariola on 8/12/2024 in #❓┊help
Using a FileUpload input in a Custom Page
But now I have another question. How can I fill the imagesForm? In my mount() method I have:
if ($this->brief) {
$existentImages = [
'cover' => $this->brief->briefImages->where('is_cover', true)->pluck('path')->first(),
'cover_alt_text' => $this->brief->briefImages->where('is_cover', true)->pluck('alt_text')->first(),
'cover_credits_text' => $this->brief->briefImages->where('is_cover', true)->pluck('credits_text')->first(),
'other_images' => $this->brief->briefImages->where('is_cover', false)->pluck('path')->toArray(),
];
}

// gestione dei form
$this->imagesForm->fill($existentImages);
if ($this->brief) {
$existentImages = [
'cover' => $this->brief->briefImages->where('is_cover', true)->pluck('path')->first(),
'cover_alt_text' => $this->brief->briefImages->where('is_cover', true)->pluck('alt_text')->first(),
'cover_credits_text' => $this->brief->briefImages->where('is_cover', true)->pluck('credits_text')->first(),
'other_images' => $this->brief->briefImages->where('is_cover', false)->pluck('path')->toArray(),
];
}

// gestione dei form
$this->imagesForm->fill($existentImages);
and the array is correct. But the FileUpload inputs remain blank
16 replies
FFilament
Created by Davide Cariola on 8/12/2024 in #❓┊help
Using a FileUpload input in a Custom Page
Ok, found the problem 😄 I had to use the imagesData array, and not the getState() method.
16 replies
FFilament
Created by Davide Cariola on 7/25/2024 in #❓┊help
Htmlable label - illegal offset type
@Dennis Koch I solved the problem: in AppServiceProvider I created this function:
protected static function translateLabel(Field|Column $element): string
{
$label = $element->getLabel();

if($label instanceof HtmlString){
return $label;
}

return __($label);
}
protected static function translateLabel(Field|Column $element): string
{
$label = $element->getLabel();

if($label instanceof HtmlString){
return $label;
}

return __($label);
}
and then:
Field::configureUsing(function (Field $field){
self::translateLabel($field);
});

Column::configureUsing(function (Column $column) {
self::translateLabel($column);
});
Field::configureUsing(function (Field $field){
self::translateLabel($field);
});

Column::configureUsing(function (Column $column) {
self::translateLabel($column);
});
For now it's working 😄 thanks for your input!
10 replies
FFilament
Created by Davide Cariola on 7/25/2024 in #❓┊help
Htmlable label - illegal offset type
@Dennis Koch could it be that I have this in the AppServiceProvider?
Field::configureUsing(function (Field $field){
$field->translateLabel();
});

Column::configureUsing(function (Column $column) {
$column->translateLabel();
});
Field::configureUsing(function (Field $field){
$field->translateLabel();
});

Column::configureUsing(function (Column $column) {
$column->translateLabel();
});
EDIT: Yes, I commented the code above and now it works without problems, but I really need the labels to be automatically translated without me writing it 😅
10 replies
FFilament
Created by Davide Cariola on 7/25/2024 in #❓┊help
Htmlable label - illegal offset type
Sadly, also with this kind of code:
IconColumn::make('test')
->label(fn() => new HtmlString('<b>test</b>'))
->boolean()
->toggleable(),
IconColumn::make('test')
->label(fn() => new HtmlString('<b>test</b>'))
->boolean()
->toggleable(),
It returns the same error. I'm working on already-done code, so I'm trying to understand what's happening 😅
10 replies
FFilament
Created by Davide Cariola on 7/25/2024 in #❓┊help
Htmlable label - illegal offset type
Ok, I'll look into that 🤔 thank you Dennis!
10 replies
FFilament
Created by Davide Cariola on 7/25/2024 in #❓┊help
Htmlable label - illegal offset type
No description
10 replies
FFilament
Created by Kidasu X Stream on 7/21/2024 in #❓┊help
Is there a way to make Select Field read only when creating/inputting data?
Can you please rephrase the flow you're thinking of? I cannot picture it, sorry
8 replies
FFilament
Created by Kidasu X Stream on 7/21/2024 in #❓┊help
Is there a way to make Select Field read only when creating/inputting data?
If I understood correctly, you can use the disabledOn method. For example:
TextInput::make('landing_url')
->label(__('Landing'))
->live(debounce: 300)
->placeholder('https://')
->suffixIcon('heroicon-m-globe-alt')
->disabledOn('edit')
->required()
->url(),
TextInput::make('landing_url')
->label(__('Landing'))
->live(debounce: 300)
->placeholder('https://')
->suffixIcon('heroicon-m-globe-alt')
->disabledOn('edit')
->required()
->url(),
and as parameter you can use create or edit
8 replies
FFilament
Created by Davide Cariola on 7/2/2024 in #❓┊help
Filter for calculated field
No description
8 replies
FFilament
Created by Davide Cariola on 7/6/2024 in #❓┊help
Problem with CreateOptionForm
Thanks a lot @Kenneth Sese! It seems like no solution has been found yet. For now, I used this workaround in the CreateAction:
->successRedirectUrl(PropertyResource::getUrl('edit', ['record' => $this->getOwnerRecord()]))
->successRedirectUrl(PropertyResource::getUrl('edit', ['record' => $this->getOwnerRecord()]))
I'll let the customer decide if this UX is good or not 😄
4 replies
FFilament
Created by Davide Cariola on 7/6/2024 in #❓┊help
Problem with CreateOptionForm
No description
4 replies
FFilament
Created by Davide Cariola on 7/2/2024 in #❓┊help
Filter for calculated field
Thanks everyone. Tomorrow I'll work on it and let you know!
8 replies
FFilament
Created by Davide Cariola on 7/2/2024 in #❓┊help
Filter for calculated field
Hi, thank you for the response! I was wandering about an SQL view. When you talk about a virtual column you intend in filament or in the DB?
8 replies