F
Filamentβ€’6mo ago
Mikail

Saving TextInputColumn in a different table

I need a way to save value in a different table rather than the static model. IT makes the update in the default model.
Solution:
then use something like TextInputColumn::make('applications.screening_mark')...
Jump to solution
13 Replies
Mikail
MikailOPβ€’6mo ago
Anyone?
krekas
krekasβ€’6mo ago
use laravel observer
Umar Farooq
Umar Farooqβ€’6mo ago
inside the EditResource class
protected function handleRecordUpdate(Model $record, array $data): Model
{
return parent::handleRecordUpdate($record, $data); // TODO: Change the autogenerated stub
}
protected function handleRecordUpdate(Model $record, array $data): Model
{
return parent::handleRecordUpdate($record, $data); // TODO: Change the autogenerated stub
}
Mikail
MikailOPβ€’6mo ago
i do no understand. the code is: TextInputColumn::make('screening_mark') i wish to save in applications table not user (default model)
Mikail
MikailOPβ€’6mo ago
the error its giving is
No description
Umar Farooq
Umar Farooqβ€’6mo ago
in which table screening_mark column exists?
Mikail
MikailOPβ€’6mo ago
applications table
Umar Farooq
Umar Farooqβ€’6mo ago
is there a relation with the users table?
toeknee
toekneeβ€’6mo ago
Just set the field is a relationship if it's a select field with a morph
Mikail
MikailOPβ€’6mo ago
yes
Solution
Umar Farooq
Umar Farooqβ€’6mo ago
then use something like TextInputColumn::make('applications.screening_mark')
Umar Farooq
Umar Farooqβ€’6mo ago
filament automatically handle where applications is the relation define in the user model
Mikail
MikailOPβ€’6mo ago
indeed this solution worked πŸ˜… . thanks a bunch. leveraging on the existing relationship worked. I'm grateful for your insights
Want results from more Discord servers?
Add your server