karim charfaoui
Repeater
how can we fill repeater with prebuild data on create page
ex:
my process is
1- create an order with order_items=> (id_order, id_article, quantity, unit_price, invoice_id) then send it to our supplier invoice_id =>null
2-when we get a supplier invoice we generate this one from order and we we each orderItems with updating
invoice_id, and unit_price
2 replies
Fill repeater on createView
I'm facing an issue while implementing an invoice creation . I'm using the Repeater component to display order items (commandeItems)
Here's a summary of what I have set up:
I have a Commande model with a hasMany relationship to CommandeItem.
I have an Invoice model with a hasMany relationship to CommandeItem
I'm using CreateInvoice, which extends Filament's CreateRecord to create a new invoice.
In CreateInvoice, I fetch a specific order with its associated articles (commandeItems) and attempt to pre-fill them in the form using mapCommandeItemsForForm().
Despite this, the Repeater for commandeItems stays empty when I open the form.
then i fill my form
10 replies
unique multiple columns
how can i do unique multiple colums exemple :`
->unique('user_job',ignoreRecord: true,modifyRuleUsing: function (Unique $rule,callable $get) {
return $rule
$table->unique('user_id','job_id','start_date')
})
thanks2 replies
multiple unique column
good evening, I have 3 tables users, jobs and finally the pivot table user_job with the pivot fields "start_date" and "end_date" and also
$table->unique('user_id','job_id','start_date')
, in my UserResource I have the following repeater:
Repeater::make('userJobs')
->label('')
->relationship()
->schema([
Select::make('job_id')
->options(Job::all()->pluck('name', 'id'))
->required()
->unique('user_job',ignoreRecord: true),
DatePicker::make('date_start')
->required()
->format('d/m/Y'),
DatePicker::make('date_end')
->format('d/m/Y'),
]),
If possible, I would like some help to respect $table->unique('user_id','job_id','start_date')
thank you in advance for your help7 replies
Create Options Forms on a Select
Hello how can i create an option Forms on my non-relationship Select :
Forms\Components\Repeater::make('userFonctions')
->relationship()
->schema([
Forms\Components\Select::make('fonction_id')
->label('Fonction')
->options(Fonction::query()->pluck('name', 'id'))
->required()
->columnSpan([
'md' => 5,
])
->searchable()
->createOptionForm([
Forms\Components\TextInput::make('name')
->label('nom')
->unique(ignoreRecord: true)
->maxLength(255)
->required(),
Forms\Components\TextInput::make('diminutif')
->label('Abréviation')
->unique(ignoreRecord: true)
->maxLength(255)
->required(),
]),
11 replies
Update my query on my Resource
hello, in my application I have the users, schools and school_user tables which is a pivot table with the is_owner field. now in my SchoolResource I would like to retrieve just the schools with the pivot fields of the authenticated user for this I created a method
public function ownedByUser(User $user): Collection
{
return $this->belongsToMany(User::class, 'school_user')
->wherePivot('is_owner', true)
->wherePivot('user_id', $user->id)
->get();
}
or i can create another method in my User model
public function ownedSchools(): Collection
{
return $this->schools()
->wherePivot('is_owner', true)
->get();
}
also i'm using force-deletes
my question and how can I call it at my SchoolResource thank you7 replies
Add year switcher
Hello, for my school management application I would like to add a switcher which contains the list of school years which is a vital variable to display the data I would like to add it next to the search field
thank you in advance for your help
8 replies
Configure filament shield with filament-multi-guard
im using iotronlab filament-multi-guard pluging with 2 context the default one with admin guard and filament-users context with web guard
and im using 2 Models for the auth Admin, User Model. I also installed filament shield but i have some issus
5 replies