afdhal
afdhal
FFilament
Created by afdhal on 3/1/2024 in #❓┊help
Import Action Relation with OptionForm
public function resolveRecord(): ?Siswa
{

$siswa = Siswa::query()
->where('nisn', $this->data['nisn'])
->first();

if (! $siswa) {
$siswa = new Siswa([
'sekolah_id' => $this->options['sekolah_id'],
'periode_id' => $this->options['periode_id'],
'cetak_kartu' => $this->options['cetak_kartu'] ? 1 : 0,
]);
}

return $siswa;
}
public function resolveRecord(): ?Siswa
{

$siswa = Siswa::query()
->where('nisn', $this->data['nisn'])
->first();

if (! $siswa) {
$siswa = new Siswa([
'sekolah_id' => $this->options['sekolah_id'],
'periode_id' => $this->options['periode_id'],
'cetak_kartu' => $this->options['cetak_kartu'] ? 1 : 0,
]);
}

return $siswa;
}
6 replies
FFilament
Created by afdhal on 3/1/2024 in #❓┊help
Import Action Relation with OptionForm
Solution
⁠ return new Siswa([
'school_id' => $this->options['school_id'],
]); ⁠
⁠ return new Siswa([
'school_id' => $this->options['school_id'],
]); ⁠
6 replies
FFilament
Created by afdhal on 3/1/2024 in #❓┊help
Import Action Relation with OptionForm
:fi: please help
6 replies
FFilament
Created by afdhal on 2/22/2024 in #❓┊help
how to store repeater data in 1 table, I get an error:Array to string conversion
You are trying to retrieve the value of client_id from inside the repeater item.

$get() is relative to the current repeater item, so $get('client_id') is looking for $get('repeater.item1.client_id').

You can use ../ to go up a level in the data structure, so $get('../client_id') is $get('repeater.client_id') and $get('../../client_id') is $get('client_id')
You are trying to retrieve the value of client_id from inside the repeater item.

$get() is relative to the current repeater item, so $get('client_id') is looking for $get('repeater.item1.client_id').

You can use ../ to go up a level in the data structure, so $get('../client_id') is $get('repeater.client_id') and $get('../../client_id') is $get('client_id')
https://filamentphp.com/docs/3.x/forms/fields/repeater
4 replies
FFilament
Created by afdhal on 2/22/2024 in #❓┊help
how to store repeater data in 1 table, I get an error:Array to string conversion
in this case I have succeeded, but how to retrieve the school_id on selected tabs 1, then on tabs 2 selected teacher_id will filter from the school_id value
// Tabs 1
School Selected

Select::make('school_id')
->pluck('name', 'id'))
->live()
->required(),
// Tabs 2
Teacher Repeater

Select::make('teacher_id')
->pluck('name', 'id');
})
->required()
->searchable()
// Tabs 1
School Selected

Select::make('school_id')
->pluck('name', 'id'))
->live()
->required(),
// Tabs 2
Teacher Repeater

Select::make('teacher_id')
->pluck('name', 'id');
})
->required()
->searchable()
4 replies