BBB
BBB
FFilament
Created by BBB on 4/24/2024 in #❓┊help
open_basedir restriction in effect : FileUpload::make('attachment')
Hello, I've been having an issue for several days now... When I perform a "simple" upload directly via Request, I have no problems:
<form action="{{ route('test-upload.import') }}" method="post" enctype="multipart/form-data">
@csrf
<input type="file" id="file" name="file" accept=".csv" onchange="this.form.submit()">
</form>
<form action="{{ route('test-upload.import') }}" method="post" enctype="multipart/form-data">
@csrf
<input type="file" id="file" name="file" accept=".csv" onchange="this.form.submit()">
</form>
Route::post('/test-upload', fn(Request $request) => dd($request->file('file')))->name('test-upload.import');
Route::post('/test-upload', fn(Request $request) => dd($request->file('file')))->name('test-upload.import');
However, when I use Filament, it doesn't work...
Actions\Action::make('file')
->label(__('filament.drug-ressource.import'))
->form([
FileUpload::make('attachment')->getUploadedFileNameForStorageUsing(fn (TemporaryUploadedFile $file) => dd($file))
])
Actions\Action::make('file')
->label(__('filament.drug-ressource.import'))
->form([
FileUpload::make('attachment')->getUploadedFileNameForStorageUsing(fn (TemporaryUploadedFile $file) => dd($file))
])
open_basedir restriction in effect. file(/tmp) is not within the allowed path
upload_tmp_dir is set to /home/web1781/temp_uploads What should I do...? I've tried "everything"... Thank you so much.
2 replies
FFilament
Created by BBB on 4/2/2024 in #❓┊help
Customizing Data Insertion with Filament's Import Action
Hello, Regarding the import: https://filamentphp.com/docs/3.x/actions/prebuilt-actions/import Is it possible to manage the insertion oneself via a method? It seems this is not possible as it is for createRecord... Or am I mistaken? Thank you in advance for your response, Have a great day
2 replies
FFilament
Created by BBB on 2/25/2024 in #❓┊help
TextColumn N+1 official demo
Hi, From official : https://github.com/filamentphp/demo/blob/a940c5a2c26a2a943273c526127a90c03ced6567/app/Filament/Resources/Shop/CustomerResource.php#L86
Tables\Columns\TextColumn::make('country')
->getStateUsing(fn ($record): ?string => Country::find($record->addresses->first()?->country)?->name ?? null)
Tables\Columns\TextColumn::make('country')
->getStateUsing(fn ($record): ?string => Country::find($record->addresses->first()?->country)?->name ?? null)
Is it okay to do that? Won't it make a query for each row? Thank you
2 replies
FFilament
Created by BBB on 2/25/2024 in #❓┊help
TextColumn BelongsToMany
Hello, I have a question regarding TextColumn and accessing attributes from a BelongsToMany relationship. Consider the following case (I've simplified it to get to the point) :
class Drug extends Model
{
public function routes(): BelongsToMany
{
return $this->belongsToMany(Route::class);
}
}

class Route extends Model
{
protected function test(): Attribute
{
return Attribute::make(get: fn () => 'test');
}
}
class Drug extends Model
{
public function routes(): BelongsToMany
{
return $this->belongsToMany(Route::class);
}
}

class Route extends Model
{
protected function test(): Attribute
{
return Attribute::make(get: fn () => 'test');
}
}
So, I can do this in Filament:
TextColumn::make('routes.id')
TextColumn::make('routes.id')
But not this:
TextColumn::make('routes.test')
TextColumn::make('routes.test')
My solution :
TextColumn::make('routes')->getStateUsing(
fn (Model $model) => $model
->routes
->pluck('test')
->join(', ')
)
TextColumn::make('routes')->getStateUsing(
fn (Model $model) => $model
->routes
->pluck('test')
->join(', ')
)
Is there a more elegant solution? Especially since in the above case, I'm forced to eager load the routes, otherwise, I'm in an n+1 situation. Any help? Thanks in advance!
2 replies
FFilament
Created by BBB on 2/23/2024 in #❓┊help
Edit issue with package
Hi, Package : laravel-translatable astrotomic Using the mentioned package, the EditRecord has an issue during validation: it saves correctly in the database, but the old data is displayed. I solved the problem by adding this:
protected function afterSave(): void
{
$this->record->refresh();
$this->form->fill($this->record->toArray());
}
protected function afterSave(): void
{
$this->record->refresh();
$this->form->fill($this->record->toArray());
}
Usually, I never encounter this problem, any ideas? Thank you.
2 replies
FFilament
Created by BBB on 2/23/2024 in #❓┊help
Sortable relation...
Hello everyone! This works:
Tables\Columns\TextColumn::make('user.lastname')->sortable()
Tables\Columns\TextColumn::make('user.lastname')->sortable()
This obviously does not work:
Tables\Columns\TextColumn::make('user.full_name')->sortable()
Tables\Columns\TextColumn::make('user.full_name')->sortable()
full_name is a combination of lastname and firstname. How should I proceed? Should I create a scope since it's in a relationship? Any help? Thanks in advance!
5 replies
FFilament
Created by BBB on 2/18/2024 in #❓┊help
Database notification translation
No description
3 replies
FFilament
Created by BBB on 8/13/2023 in #❓┊help
Columns(3) too much text...
3 replies
FFilament
Created by BBB on 8/6/2023 in #❓┊help
Action without refreshing component ?
Hi, Is it possible to have an action without request to component ?
Action::make('details')->action(fn (Asset $record) => $this->dispatch('modal', component: 'file-details', params : ['uuid' => $record->uuid]))
Action::make('details')->action(fn (Asset $record) => $this->dispatch('modal', component: 'file-details', params : ['uuid' => $record->uuid]))
He's doing this :
wire:click="mountTableAction('details', '5')
wire:click="mountTableAction('details', '5')
Is it possible to directly have a button instead ? @click="$dispatch('modal')". Thank you.
2 replies
FFilament
Created by BBB on 8/6/2023 in #❓┊help
Resources without Panel Builder ?
Hi, I have form builder and table builder installed. Inside my table builder I also have a form builder for editing. Which makes my livewire component a bit long... Is it possible to create a resource class in order to put the forms in it, a bit like Panel Builder - Resources? Thanks in advance
5 replies
FFilament
Created by BBB on 8/5/2023 in #❓┊help
Filament Table With default ?
4 replies
FFilament
Created by BBB on 8/1/2023 in #❓┊help
Form Builder Only ORANGE Color since V3
import preset from './vendor/filament/support/tailwind.config.preset'
import colors from 'tailwindcss/colors'

export default {
presets: [preset],
content: [
'./resources/**/*.blade.php',
'./app/Filament/**/*.php',
'./resources/views/filament/**/*.blade.php',
'./vendor/filament/**/*.blade.php'
],
theme: {
extend: {
colors: {
danger: colors.rose,
primary: colors.blue,
success: colors.green,
warning: colors.yellow,
},
},
}
}
import preset from './vendor/filament/support/tailwind.config.preset'
import colors from 'tailwindcss/colors'

export default {
presets: [preset],
content: [
'./resources/**/*.blade.php',
'./app/Filament/**/*.php',
'./resources/views/filament/**/*.blade.php',
'./vendor/filament/**/*.blade.php'
],
theme: {
extend: {
colors: {
danger: colors.rose,
primary: colors.blue,
success: colors.green,
warning: colors.yellow,
},
},
}
}
Unfortunately, nothing inside the documentation about this inside form builder only :(. With v2, it was blue. Thank you in advance for your help !
3 replies