Felix
how to upload file to an s3 bucket in the beforeCreate function?
Hello, I want upload an png to an s3 bucket via the beforeCreate function,
this is the first time I am using s3 so I am some what green with this.
I am working this way becase I am using it to upload info to an api and then halting it.
but i don't know how to get the (temporary) file in the beforeCreate to upload them.
I have installed
league/flysystem-aws-s3-v3
, and put in my AWS S3 in the .env file.
and have tested the the functions in the Laravel and Livewire docs,
but it doesn't work.
how do you save files to an S3 in an beforeCreate?
And this is my code if you are interested:
protected function beforeCreate(): void
{
// this doesn't work [
foreach ($this->oldFormState['data']['header_image'] as $img){
dd($img);
$img->store('photos', 's3');
}
$result = $this->data['header_image']->store('photos', 's3-public');
dd($this);
// ]
$this->data['event']['languages'] = json_encode($this->data['event']['select_languages']);
$event = Live::events()->post($this->data)->body();
$event_data =json_decode($event);
if ($event_data->type == 'error'){
Notification::make()
->title('De link "' .$event_data->value. '" word al gebruikt!')
->warning()
->send();
$this->halt();
}
Notification::make()
->title('Opslaan succesvol')
->success()
->send();
redirect()->route('filament.admin.event.resources.events.edit', ['record' => json_decode($event_data->value->id)]);
$this->halt();
}
4 replies
How do you make tables communicate with each other.
I want to make an page with two tables, where on the first I have an list of all talk rooms and on the second I have all the participants of the selected room. How do I make it so that both are on the same page and both are made by the filament table builder?
15 replies
Error `Could not find Livewire component in DOM tree`. How do I fix this?
I have an laravel page with an filament table component, but the paination is not working, I looked in my browser console and got this:
Could not find Livewire component in DOM tree
, what does this mean and how do I fix this?5 replies
How do I make the Textinput datalist dorpdown none native?
I am making an form with an input where you can type or chose what role you have but it uses native select dropdown. is it posible to make the Textinput datalist dorpdown none native like the select?
3 replies
Question: why does the Table go under the $table->contentFooter().
I have been testing on how I can make an footer with an action button under my table, but the table goes under the footer (when i use $table->contentFooter()). I also have tested it on an clean new project and it does the same. what is the method/way to fix this?
5 replies
filament Table main content goes under the footer.
Hello, I am working on an Livewire component with an filament table (made via:
php artisan make:livewire-table
) and I am adding an custom footer to it, but the table goes under the footer (the footer is added by: ->contentFooter()
). so the order of the table is: Header -> Footer -> Table. and I can't find the solution in the docs. what am I doing wrong?
the code:
public function table(Table $table): Table
{
return $table
->heading('upcoming Projects')
->query(Project::query())
->modifyQueryUsing(fn(Builder $query) => $query->where('project_date','>=', now())->take(4))
->columns([
Tables\Columns\TextColumn::make('name'),
Tables\Columns\TextColumn::make('project_date'),
])
->actions([
Tables\Actions\Action::make('go to')
->url(fn (Project $record): string => route('project.show', ['id' => $record]))
])
->contentFooter(\view('livewire.projects.footers.table-footer'))
->paginated(false);
}
4 replies
costom table widget query is empty
I am trying to have an table with all upcoming projects that I have, but when there are no project coming it gives an
Unable to create query for empty collection.
. the code is
public function table(Table $table): Table
{
return $table
->query(
function () {
return Project::where('project_date','>=', now())->get()->sortBy('project_date')->take(7)->ToQuery();
}
)
->columns([
Tables\Columns\TextColumn::make('name'),
Tables\Columns\TextColumn::make('project_date'),
])
->defaultSort('project_date')
->actions([
Tables\Actions\EditAction::make()
->url(fn (Project $record): string => route('filament.admin.resources.projects.edit', ['record' => $record]))
])
->emptyStateHeading('No upcoming projects')
->paginated(false);
}
I am rather new with widgets and I haven't worked with ->query before.4 replies
How to use an api in filament
I have been trying to do is to use an external api with filament to list, view and edit.
What I have done is installing an api driver on my Laravel project and looked to integrate the api with my filament.
I tried to do it with a normal resource but i have no luck in making it work, I have also looked in the custom tables, forms and view docs but no luck.
I can't find the relevant docs to make it work.
Is it possible to use an api with filament?
note: i am rather new with external api's in Laravel and Filament.
28 replies