syed_eer
How to Use ->relationship() with $get() in $form?
I will appriciate if you could give some insight on this query inside ->searcheable()
->searchable(query: function (Builder $query, string $search): Builder {
return $query->leftJoin('vehicles', function($join) {
$join->on('vehicles.id', '=', 'quotations.vehicle_id')
->whereColumn('vehicles.customer_id', '=', 'quotations.customer_id');
})
->leftJoin('guest_customers', 'guest_customers.id', '=', 'quotations.guest_customer_id')
->select('quotations.*', 'vehicles.plate_no as vehicle_plate', 'guest_customers.gst_plate_no as guest_plate')
->where('vehicles.plate_no', 'like', "%{$search}%")
->orWhere('guest_customers.gst_plate_no', 'like', "%{$search}%");
})
but it gives error
6 replies
Filament Repeater Not Passing Foreign Key (make_id) - SQL Error 1364
@Dennis Koch Thank you for your reply
I tried that as well like this
Forms\Components\Select::make('make_id')
->label('Vehicle Make')
->preload()
->options(\App\Models\VehicleMake::pluck('make_name', 'id'))
->required()
->searchable()
->reactive(),
but still the same error. It works fine without Repeaters, I dont know what is that i'm doing wrong with repeaters.
5 replies
how can I customise the section's width?
Placeholder::make('course_selected')->label('Course Selected')->disabled()->content(
fn ($get) => $get('course_selected')
)->extraAttributes(['class' => 'text-blue-500'])
and Section::make('Student Summary')
->columnSpan(1)
->schema([
])->extraAttributes(['class' => 'text-blue-500']),
tried both ways, its not working.9 replies
Text or TextInput fiedl can be dynamically populated?
wow, this also works,
Select::make('student_id')
->label('Student Name')
->options(Student::all()->pluck('name', 'id')->toArray())->reactive()->live()
->afterStateUpdated(function ($state, $set) {
if ($state) {
$set('fee_plan_name', Student::find($state)->fee_plan->name);
} else {
$set('fee_plan_name', '');
}
})->searchable(),
TextInput::make('fee_plan_name')->disabled(),
46 replies
Text or TextInput fiedl can be dynamically populated?
with your kind help, I think somehow I got this working, could you please check this code.
Select::make('student_id')
->label('Student Name')
->options(Student::all()->pluck('name', 'id')->toArray())->reactive()->live()
->afterStateUpdated(function ($state, $set) {
if ($state) {
$fPId = Student::find($state)->fee_plan_id;
$FPidMatch = FeePlan::where('id', $fPId)->get();
$stdFPname = $FPidMatch->pluck('name');
$set('fee_plan_name', $stdFPname);
} else {
$set('fee_plan_name', '');
}
})->searchable(),
TextInput::make('fee_plan_name')->disabled(),
46 replies
Text or TextInput fiedl can be dynamically populated?
yeah, that's right, I just need whenever the student name gets selected from the dropdown, the fee_plan_name changes accordingly (based on the fee_plan selected by this particular student in the students table).
46 replies