mirror of
https://github.com/anna-sara/filament_inventory
synced 2025-10-26 21:17:13 +01:00
Updated create item category select
This commit is contained in:
parent
de94eb4e30
commit
b22d05538e
1 changed files with 14 additions and 2 deletions
|
|
@ -67,6 +67,7 @@ class ItemResource extends Resource
|
||||||
->schema([
|
->schema([
|
||||||
Radio::make('type')
|
Radio::make('type')
|
||||||
->translateLabel()
|
->translateLabel()
|
||||||
|
->live()
|
||||||
->options([
|
->options([
|
||||||
'game' => __('Game'),
|
'game' => __('Game'),
|
||||||
'item' => __('Item'),
|
'item' => __('Item'),
|
||||||
|
|
@ -99,9 +100,20 @@ class ItemResource extends Resource
|
||||||
->default(0)
|
->default(0)
|
||||||
->hidden(fn ($get): string => $get('type') == 'game' || $get('type') == 'literature' ),
|
->hidden(fn ($get): string => $get('type') == 'game' || $get('type') == 'literature' ),
|
||||||
Select::make('category_id')
|
Select::make('category_id')
|
||||||
->label('Category')
|
->label('Category items')
|
||||||
->translateLabel()
|
->translateLabel()
|
||||||
->options(Category::all()->pluck('name', 'id')),
|
->options(Category::where('type', 'item')->pluck('name', 'id'))
|
||||||
|
->hidden(fn ($get): string => $get('type') == 'game' || $get('type') == 'literature' ),
|
||||||
|
Select::make('category_id')
|
||||||
|
->label('Category games')
|
||||||
|
->translateLabel()
|
||||||
|
->options(Category::where('type', 'game')->pluck('name', 'id'))
|
||||||
|
->hidden(fn ($get): string => $get('type') == 'item' || $get('type') == 'literature' ),
|
||||||
|
Select::make('category_id')
|
||||||
|
->label('Category literature')
|
||||||
|
->translateLabel()
|
||||||
|
->options(Category::where('type', 'literature')->pluck('name', 'id'))
|
||||||
|
->hidden(fn ($get): string => $get('type') == 'game' || $get('type') == 'item' ),
|
||||||
TextInput::make('cost')
|
TextInput::make('cost')
|
||||||
->label('Price')
|
->label('Price')
|
||||||
->translateLabel()
|
->translateLabel()
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue