This commit is contained in:
2025-09-25 03:03:31 +05:00
commit ae480cf2f6
2768 changed files with 1485826 additions and 0 deletions

View File

@@ -0,0 +1,44 @@
<?php
namespace Nurmuhammet\ProductInventory;
use Illuminate\Support\Collection;
use Laravel\Nova\Fields\Field;
use Laravel\Nova\Fields\SupportsDependentFields;
class ProductInventory extends Field
{
use SupportsDependentFields;
/**
* The field's component.
*
* @var string
*/
public $component = 'product-inventory';
/**
* Set the options for the select menu.
*
* @param array<string|int, array<string, mixed>|string>|\Closure|callable|\Illuminate\Support\Collection $options
* @return $this
*
* @phpstan-param TOption|(callable(): (TOption))|(\Closure(): (TOption)) $options
*/
public function options(array|Collection $options): self
{
return $this->withMeta([
'options' => $this->serializeOptions($options),
]);
}
/**
* Serialize Options
*
* @param Collection $options
*/
public function serializeOptions(array|Collection $options): array|Collection
{
return collect($options)->map(fn ($label, $value) => ['label' => $label, 'value' => $value]);
}
}