F
Filamentβ€’4w 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
Mikailβ€’4w ago
Anyone?
krekas
krekasβ€’4w ago
use laravel observer
Umar Farooq
Umar Farooqβ€’4w 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
Mikailβ€’4w ago
i do no understand. the code is: TextInputColumn::make('screening_mark') i wish to save in applications table not user (default model)
Mikail
Mikailβ€’4w ago
the error its giving is
No description
Umar Farooq
Umar Farooqβ€’4w ago
in which table screening_mark column exists?
Mikail
Mikailβ€’4w ago
applications table
Umar Farooq
Umar Farooqβ€’4w ago
is there a relation with the users table?
toeknee
toekneeβ€’4w ago
Just set the field is a relationship if it's a select field with a morph
Mikail
Mikailβ€’4w ago
yes
Solution
Umar Farooq
Umar Farooqβ€’4w ago
then use something like TextInputColumn::make('applications.screening_mark')
Umar Farooq
Umar Farooqβ€’4w ago
filament automatically handle where applications is the relation define in the user model
Mikail
Mikailβ€’4w 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
More Posts