35 lines
929 B
PHP
35 lines
929 B
PHP
|
<?php
|
||
|
|
||
|
namespace App\View\Components;
|
||
|
|
||
|
use Closure;
|
||
|
use Illuminate\Contracts\View\View;
|
||
|
use Illuminate\Support\Collection;
|
||
|
use Illuminate\View\Component;
|
||
|
|
||
|
class SelectDropdown extends Component
|
||
|
{
|
||
|
public Collection $options;
|
||
|
public ?string $fieldName;
|
||
|
public ?int $modelId;
|
||
|
public string|int|null $selected;
|
||
|
/**
|
||
|
* Create a new component instance.
|
||
|
*/
|
||
|
public function __construct( Collection $options, int|null $modelId = null, string|null $fieldName = null, string|int|null $selected = null)
|
||
|
{
|
||
|
//dd($options,$modelId,$fieldName,$selected);
|
||
|
$this->options = $options;
|
||
|
$this->fieldName = $fieldName;
|
||
|
$this->modelId = $modelId;
|
||
|
$this->selected = $selected;
|
||
|
}
|
||
|
|
||
|
/**
|
||
|
* Get the view / contents that represent the component.
|
||
|
*/
|
||
|
public function render(): View|Closure|string
|
||
|
{
|
||
|
return view('components.select-dropdown');
|
||
|
}
|
||
|
}
|