TextInput::make('catalog')
->label(__('filament.warehouse.product.catalog'))
->minLength(3)
->live()
->required()
->debounce(500)
->afterStateUpdated(function (Get $get, Set $set, $state) {
if (!empty($state)){
$query = Item::where('catalog', $state);
if ($query->exists()){
$item = $query->get()->first();
//setting relation?
}
}
})
->datalist(fn() => Item::distinct('catalog')->pluck('catalog')->toArray()),
Group::make()
->relationship('item')
->schema([
Forms\Components\SpatieMediaLibraryFileUpload::make('images')
->imagePreviewHeight('125')
->reactive()
->image()
->multiple()
->optimize('webp')
->resize(30)
->conversion('img')
->label('')
->collection(Item::ITEM_COLLECTION_NAME)
->directory('products')
->imageEditor()
->enableReordering(),
])
TextInput::make('catalog')
->label(__('filament.warehouse.product.catalog'))
->minLength(3)
->live()
->required()
->debounce(500)
->afterStateUpdated(function (Get $get, Set $set, $state) {
if (!empty($state)){
$query = Item::where('catalog', $state);
if ($query->exists()){
$item = $query->get()->first();
//setting relation?
}
}
})
->datalist(fn() => Item::distinct('catalog')->pluck('catalog')->toArray()),
Group::make()
->relationship('item')
->schema([
Forms\Components\SpatieMediaLibraryFileUpload::make('images')
->imagePreviewHeight('125')
->reactive()
->image()
->multiple()
->optimize('webp')
->resize(30)
->conversion('img')
->label('')
->collection(Item::ITEM_COLLECTION_NAME)
->directory('products')
->imageEditor()
->enableReordering(),
])