riz
Can't use FileUpload with multiple
if I use hasMany in the model I get this error.
ERROR:
If I understand it correctly from this
https://filamentphp.com/docs/3.x/forms/advanced#saving-data-to-relationships
thats how I use the FileUpload inside the component Section with relationship.
I thought hasOne will work, since multiple in FileUpload will
store an array of multiple filename( in my case: attachment_path) in a column.
I was expecting my database would store the record like this if I use
->multiple()
if I use hasMany in the model I get this error.
ERROR:
If I understand it correctly from this
https://filamentphp.com/docs/3.x/forms/advanced#saving-data-to-relationships
thats how I use the FileUpload inside the component Section with relationship.
I thought hasOne will work, since multiple in FileUpload will
store an array of multiple filename( in my case: attachment_path) in a column.
I was expecting my database would store the record like this if I use
->multiple()
4 replies
afterCreate() function can't get the last saved record id, dd() show the error below:
if I declare the model like this:
class Model extends Pivot
then the
protected function afterCreate(): void
{
dd($this->record->id);
}
shows null, if I check the database, a new record is already added with the id
8 replies
afterCreate() function can't get the last saved record id, dd() show the error below:
dd($this->record); also shows below
App\Models\Applicant {#2976 ▼ // app\Filament\Resources\ApplicantResource\Pages\CreateApplicant.php:23
#connection: "mysql"
#table: "award_applicant"
8 replies
Assign default value on a field during AttachAction
What I want is emplement the AttachAction in a RelationManager and save the following
fields on the db
empl_id -- <w/ user interaction Section::make>
assigned_by -- <w/ user interaction TextInput::make>
status -- <w/o user interaction>
just set the 'status' field to 'Pending' every time I click
the attach button on a RM and save it to the DB...
somewhere in Edit menu, that's where a user interaction
for the 'status' field.
so in my case I comment out the Select::make('status') part
and add the line
Hidden::make('status')->default('Pending'),
this one work, but Im not sure if this is the proper way
7 replies
Assign default value on a field during AttachAction
Updated the code but Im not sure if this is the correct way.
// Select::make('status')
// ->options([
// 'approve' => 'Approve',
// 'disapprove' => 'Disapprove',
// 'pending' => 'Pending',
// 'on-process' => 'On process',
// ])->required(),
Hidden::make('status')->default('Pending'),
7 replies