mirror of
https://github.com/snipe/snipe-it.git
synced 2026-08-20 04:07:35 +00:00
35 lines
681 B
PHP
35 lines
681 B
PHP
<?php
|
|
|
|
namespace App\Livewire;
|
|
|
|
use App\Models\ReportTemplate;
|
|
use Illuminate\Validation\Rule;
|
|
use Livewire\Attributes\Computed;
|
|
use Livewire\Component;
|
|
|
|
class ReportTemplateSelect extends Component
|
|
{
|
|
public $type;
|
|
|
|
public function render()
|
|
{
|
|
return view('livewire.report-template-select');
|
|
}
|
|
|
|
#[Computed]
|
|
public function templates()
|
|
{
|
|
return ReportTemplate::query()
|
|
->when($this->type, fn ($query) => $query->where('type', $this->type))
|
|
->orderBy('name')
|
|
->get();
|
|
}
|
|
|
|
protected function rules()
|
|
{
|
|
return [
|
|
'type' => Rule::in(['asset', 'component']),
|
|
];
|
|
}
|
|
}
|