mirror of
https://github.com/snipe/snipe-it.git
synced 2024-11-15 10:04:13 -08:00
42 lines
874 B
PHP
42 lines
874 B
PHP
<?php
|
|
|
|
namespace App\Livewire;
|
|
|
|
use Livewire\Attributes\Computed;
|
|
use Livewire\Component;
|
|
|
|
use App\Models\CustomFieldset;
|
|
use App\Models\AssetModel;
|
|
|
|
class CustomFieldSetDefaultValuesForModel extends Component
|
|
{
|
|
public $add_default_values;
|
|
|
|
public $fieldset_id;
|
|
public $model_id;
|
|
|
|
public function mount($model_id = null)
|
|
{
|
|
$this->model_id = $model_id;
|
|
$this->fieldset_id = $this->model?->fieldset_id;
|
|
$this->add_default_values = ($this->model?->defaultValues->count() > 0);
|
|
}
|
|
|
|
#[Computed]
|
|
public function model()
|
|
{
|
|
return AssetModel::find($this->model_id);
|
|
}
|
|
|
|
#[Computed]
|
|
public function fields()
|
|
{
|
|
return CustomFieldset::find($this->fieldset_id)?->fields;
|
|
}
|
|
|
|
public function render()
|
|
{
|
|
return view('livewire.custom-field-set-default-values-for-model');
|
|
}
|
|
}
|