Sugbo
Spatie Media Library Plugin for FilamentPHP not generating responsive images
Is responsive images feature a Pro feature?
Just use the syntax is the docs:
use Filament\Forms\Components\SpatieMediaLibraryFileUpload;
SpatieMediaLibraryFileUpload::make('attachments')
->multiple()
->responsiveImages()
However no multiple images is being uploaded to the storage. Its juse one file
8 replies
Unable to locate: heroicon-m-share
Hi, I am confused how to use heroicons for badges.
Well it says
"By default, the Blade Heroicons v1 package is installed, so you may use the name of any Heroicons v1 out of the box."
But when I true to use
protected static ?string $navigationIcon = 'heroicon-m-share';
Its giving this error
"Unable to locate a class or view for component [heroicon-m-share]."
7 replies
Do I have to install Spatie Media Library package if I already installed the plugin?
Hi, I don't quite understand the idea of a plugin. So basically I am using the Spatie Media Library plugin for FilamentPHP. I have installed the plugin but do I have to install the Spatie Media Library package itself? The reason why I am asking cause I wanted to upload all my files in s3 in a folder lets just call it 'attachment'. The solution for that after searching the internet is to do what is called custom directory and I need to create a custompathgenerator ? I cant find the class called pathgenerator.php. I cant seem to make it work by just installing the plug in itself?
4 replies
Form submitting even though the date is required
Hi,
I used filament form builder to require a date input using DateTimePicker.
protected function getFormSchema(): array
{
return [
DateTimePicker::make('due_date')->required() // ... ]; } However, when the user dont fill in a date and submit, the form will still submit and will throw an error because I didnt set the date to be nullable. Is there a way so that the form will not submit when the user forget to fill in a date? I have already set the field as required as shown in the code above. I don't know what is missing.
DateTimePicker::make('due_date')->required() // ... ]; } However, when the user dont fill in a date and submit, the form will still submit and will throw an error because I didnt set the date to be nullable. Is there a way so that the form will not submit when the user forget to fill in a date? I have already set the field as required as shown in the code above. I don't know what is missing.
2 replies
File Attachment Does Not Exist on Media Library Plugin/Form Builder
Hi,
I don't understand why I get "File Attachment Does Not Exist" . I am using Spatie Media Library Plugin for a file upload. I am using it not in the admin panel
This is the Livewire Class Component:
public $title ;
public $attachment;
public function render() { return view('livewire.post-question'); } public function mount(): void { $this->form->fill(); } protected function getFormSchema(): array { return [ TextInput::make('title')->required(),
SpatieMediaLibraryFileUpload::make('attachment'),
// ... ]; }
public function create(): void { Question::create($this->form->getState()); } public function submit() { $question = Question::create([ 'title' => $this -> title, 'attachment' => $this->attachment,
]); $question -> addMedia('attachment') -> toMediaCollection(); } This is the Livewire View Component: <div> <form wire:submit.prevent="submit"> {{ $this->form }}
<button type="submit" > Submit </button>
</form> </div>
public function render() { return view('livewire.post-question'); } public function mount(): void { $this->form->fill(); } protected function getFormSchema(): array { return [ TextInput::make('title')->required(),
SpatieMediaLibraryFileUpload::make('attachment'),
// ... ]; }
public function create(): void { Question::create($this->form->getState()); } public function submit() { $question = Question::create([ 'title' => $this -> title, 'attachment' => $this->attachment,
]); $question -> addMedia('attachment') -> toMediaCollection(); } This is the Livewire View Component: <div> <form wire:submit.prevent="submit"> {{ $this->form }}
<button type="submit" > Submit </button>
</form> </div>
20 replies
Rollup failed to resolve import "@awcodes/alpine-floating-ui"
Hi, I tried to run "npm run build" on production because I had problem with Date-time picker and mark-down editor. It failed and I got this error:
[vite]: Rollup failed to resolve import "@awcodes/alpine-floating-ui" from "/home/forge/mydomain/resources/js/app.js".
This is most likely unintended because it can break your application at runtime.
If you do want to externalize this module explicitly add it to
build.rollupOptions.external
I am not sure if the resolve import is related with the problem of the Date-time picker and Mark-down editor of the form builder. From I remember the @awcodes/alpine-floating-ui came from the the notification package installation.3 replies
Change location of notification pop up
Hi,
I have a flash message notification using the filament notifications. The default location is on top right .
Default setting on config/filament.php is as follows:
'notifications' => [
'vertical_alignment' => 'top',
'alignment' => 'right',
],
I wanted to change it to top-center and did the following.
'notifications' => [
'vertical_alignment' => 'top',
'alignment' => 'center',
],
However, its not working. Do I have to type something on the terminal to make this work? I have clear cache on my browser.
7 replies
show success message after submit
Hi
I been looking in the documentation how I could show some success message once data is inserted in the database after form is submitted. Couldn’t find any. Is this the one that should be done with “Notification” docs?
4 replies
How to dynamically populate select option label using the Form Builder
Hi,
I am using the Select field of the form builder.
I want to use the city names from my City model to populate the option label. If I have to do it manually it would look like this.
protected function getFormSchema(): array
{
return [
Select::make('city')
->options([
'miami' => 'Miami',
'boston' => 'Boston',
'denver' => 'Denver,
])->searchable(),
]; } What if I wanted to dynamically pull these city from the database. I assume it would look like this but obviously this does not work protected function getFormSchema(): array { return [ Select::make('city') ->options([ City::all()->pluck('city') ])->searchable(),
]; }
]; } What if I wanted to dynamically pull these city from the database. I assume it would look like this but obviously this does not work protected function getFormSchema(): array { return [ Select::make('city') ->options([ City::all()->pluck('city') ])->searchable(),
]; }
5 replies