mirror of
https://github.com/AnimeThemes/animethemes-server.git
synced 2026-07-11 01:24:46 +02:00
fix(filament): added create option using (#714)
This commit is contained in:
@@ -27,8 +27,11 @@ class BelongsTo extends ComponentsSelect
|
||||
*/
|
||||
protected function reload(): void
|
||||
{
|
||||
$model = $this->resource->getModel();
|
||||
|
||||
if ($this->showCreateOption && $this->resource !== null) {
|
||||
$this->createOptionForm(fn (Form $form) => $this->resource::form($form)->getComponents());
|
||||
$this->createOptionUsing(fn (array $data) => (new $model)::query()->create($data)->getKey());
|
||||
}
|
||||
|
||||
if ($this->resource) {
|
||||
|
||||
@@ -232,8 +232,7 @@ class Theme extends BaseResource
|
||||
->resource(ArtistResource::class)
|
||||
->showCreateOption()
|
||||
->required()
|
||||
->rules(['required'])
|
||||
->createOptionUsing(fn (array $data) => Artist::query()->create($data)->getKey()),
|
||||
->rules(['required']),
|
||||
|
||||
TextInput::make(ArtistSong::ATTRIBUTE_AS)
|
||||
->label(__('filament.fields.artist.songs.as.name'))
|
||||
|
||||
Reference in New Issue
Block a user