jamesro
jamesro
FFilament
Created by jamesro on 10/17/2024 in #❓┊help
Relation manager with pivot table doesn't show pivot table field values when edit
Hello, I have these relation on my User and Cars entities: User entity:
public function cars(): BelongsToMany
{
return $this->belongsToMany(Cars::class, 'user_cars', 'id_user', 'id_car')
->withPivot([
'data_start', 'data_end', 'disabled'
]);
}
public function cars(): BelongsToMany
{
return $this->belongsToMany(Cars::class, 'user_cars', 'id_user', 'id_car')
->withPivot([
'data_start', 'data_end', 'disabled'
]);
}
Car entity:
public function owners()
{
return $this->belongsToMany(User::class, 'user_cars', 'id_car', 'id_user')
->withPivot('data_start', 'data_end', 'disabled');
}
public function owners()
{
return $this->belongsToMany(User::class, 'user_cars', 'id_car', 'id_user')
->withPivot('data_start', 'data_end', 'disabled');
}
Unfortunately, both my User entity and user_cars pivot table have these 3 colums on them: 'data_start', 'data_end', 'disabled' Now when i try to edit an entry from user_cars using my relation manager, those 3 columns values does not get the values from the db, it works if I rename columns to something else in my pivot table: This is relation manager form:
Forms\Components\DateTimePicker::make('data_start')
->required(),
Forms\Components\DateTimePicker::make('data_end')
->required(),
Forms\Components\Toggle::make('disabled')
->inline(false)
->required(),
Forms\Components\DateTimePicker::make('data_start')
->required(),
Forms\Components\DateTimePicker::make('data_end')
->required(),
Forms\Components\Toggle::make('disabled')
->inline(false)
->required(),
any how to make it work without having to rename those columns in my pivot table?
2 replies
FFilament
Created by jamesro on 10/9/2024 in #❓┊help
dynamic repeater fields names
Hello, is it possible to make the repeater fields names dynamic? something like:
Repeater::make('recuperare_invoire')
->label('Recuperare Invoire')
->schema([
Grid::make(3)->schema([
DatePicker::make('data_recuperare_invoire'.$numberOfRepeaterItem)
->label(fn ($get, $statePath) => 'Data Recuperare ' . (intval(str_replace('.', '', $statePath)) + 1))
->required()
->native(false),

TextInput::make('recuperare_ore_invoire'.$numberOfRepeaterItem)
->label(fn ($get, $statePath) => 'Numar de Ore ' . (intval(str_replace('.', '', $statePath)) + 1))
->default(2)
->numeric()
->step(0.5)
->required(),

TextInput::make('recuperare_interval_invoire'.$numberOfRepeaterItem)
->label(fn ($get, $statePath) => 'Interval Recuperare ' . (intval(str_replace('.', '', $statePath)) + 1))
->required(),
]),
])
Repeater::make('recuperare_invoire')
->label('Recuperare Invoire')
->schema([
Grid::make(3)->schema([
DatePicker::make('data_recuperare_invoire'.$numberOfRepeaterItem)
->label(fn ($get, $statePath) => 'Data Recuperare ' . (intval(str_replace('.', '', $statePath)) + 1))
->required()
->native(false),

TextInput::make('recuperare_ore_invoire'.$numberOfRepeaterItem)
->label(fn ($get, $statePath) => 'Numar de Ore ' . (intval(str_replace('.', '', $statePath)) + 1))
->default(2)
->numeric()
->step(0.5)
->required(),

TextInput::make('recuperare_interval_invoire'.$numberOfRepeaterItem)
->label(fn ($get, $statePath) => 'Interval Recuperare ' . (intval(str_replace('.', '', $statePath)) + 1))
->required(),
]),
])
4 replies
FFilament
Created by jamesro on 10/8/2024 in #❓┊help
HasManyThrough for select field
Hello, Select field is not compatible with HasManyThrough ? Any way to make it work? i have
public function categorii()
{
return $this->hasManyThrough(Categorii::class, NecesareCategorii::class, 'id_necesar', 'id', 'id', 'id_categorie');
}
public function categorii()
{
return $this->hasManyThrough(Categorii::class, NecesareCategorii::class, 'id_necesar', 'id', 'id', 'id_categorie');
}
But in my select field when I select and save the record, doesn't seems to be creating the relation
3 replies
FFilament
Created by jamesro on 10/2/2024 in #❓┊help
FileUpload on relation ( HasOne) extra parameters
Hello, I have a case where the i have a file() relation to another File entity, and that file entity has some extra fields required Any way i can pass those extra fields values need, when I save my form?
7 replies
FFilament
Created by jamesro on 10/2/2024 in #❓┊help
How can I hide a field inside a form or repeater, but still send its data
How can I hide a field inside a form or repeater, but still send its data ( i'm populating it's data from another field ) I've tried with hidden() and visible() but it seems its data is not sent when I submit the form Regards
4 replies
FFilament
Created by jamesro on 10/1/2024 in #❓┊help
Showing a modal with list of order products
Hello, I'm trying to show the list of the order products inside a modal using table, I've created a livewire component where I pass my order it and from there in my livewire component table i set a query to bring me a table with order products, All good until i change orders page number, in the opened modal for some reason instead of starting from page number 1, it start from page set in my current orders table. Any idea how i can fix this ?
2 replies
FFilament
Created by jamesro on 9/25/2024 in #❓┊help
Add roles / permissions per team for user
No description
33 replies