Moudjames23
Moudjames23
FFilament
Created by Moudjames23 on 12/11/2023 in #❓┊help
Get current value of SelectConstraint
Hello, I want to do some filters in my table but I'm having trouble getting current value of my select. Here is my code:
SelectConstraint::make('competences')
->label("Compétences")
->searchable()
->options(
Technology::pluck("name", "id")
)
->relationship(
name: 'competences',
titleAttribute: 'id',
modifyQueryUsing: fn (Builder $query, Forms\Get $get) => $query->where('technologie_id', $get("competences")),
)
SelectConstraint::make('competences')
->label("Compétences")
->searchable()
->options(
Technology::pluck("name", "id")
)
->relationship(
name: 'competences',
titleAttribute: 'id',
modifyQueryUsing: fn (Builder $query, Forms\Get $get) => $query->where('technologie_id', $get("competences")),
)
My table competences has this fields: id, technologie_id, candidat_id, annee Thank you in advance for yours responses !
8 replies
FFilament
Created by Moudjames23 on 5/30/2023 in #❓┊help
DatePickers validation in differents Wizard's steps
Hello, I'm stuck on validating a date. Let me explain: I have a Wizard that has two Steps (Expeditions and Samples) A shipment can have one or more samples. - the Expedition step I have a 'date_depart' field - The Samples step, which is a repeater, I have a 'date_sampling' field which must be less than or equal to 'date_depart' In my Samples step, I have this:
DatePicker::make('date_prelevement')
->required()
->rules(['date'])
->beforeOrEqual('date_depart')
->label('Date de prélevement')
->placeholder('Choisir la date de prélevement')
->columnSpan([
'default' => 12,
'md' => 12,
'lg' => 12,
]),
DatePicker::make('date_prelevement')
->required()
->rules(['date'])
->beforeOrEqual('date_depart')
->label('Date de prélevement')
->placeholder('Choisir la date de prélevement')
->columnSpan([
'default' => 12,
'md' => 12,
'lg' => 12,
]),
With this code, I have the impression that the 'date_depart' field is unknown to it. Can you enlighten me please
4 replies
FFilament
Created by Moudjames23 on 4/13/2023 in #❓┊help
Custom EloquentBuilder based on current user
Hello, I need to display a list of articles based on the currently logged in user. If the user is assigned to a company, I only recover the articles of this one otherwise I recover all the articles. Here is my code:
public static function getEloquentQuery(): Builder
{
$user = Auth::user();

if ($user->entreprise_id == null)
return parent::getEloquentQuery();

return parent::getEloquentQuery()
->where('entreprise_id', '=', $user->entreprise_id);
}
public static function getEloquentQuery(): Builder
{
$user = Auth::user();

if ($user->entreprise_id == null)
return parent::getEloquentQuery();

return parent::getEloquentQuery()
->where('entreprise_id', '=', $user->entreprise_id);
}
I always have the list of all the articles displayed regardless of the logged in user I specify that it uses version v2.17.24 yet I managed to customize my request like that on another project with version v2.16.28. Can you help me please
11 replies