40 lines
810 B
PHP
40 lines
810 B
PHP
<?php
|
|
|
|
namespace App\Livewire\Drawer\Album;
|
|
|
|
use App\Models\Category;
|
|
use Carbon\Carbon;
|
|
use Livewire\Component;
|
|
use Livewire\Attributes\Validate;
|
|
use Livewire\Attributes\Locked;
|
|
use Livewire\Attributes\Computed;
|
|
|
|
class Create extends Component
|
|
{
|
|
public Category $category;
|
|
|
|
#[Validate('required|min:3')]
|
|
public string $name;
|
|
|
|
#[Validate('required|date')]
|
|
public string $capture_date_string;
|
|
|
|
#[Computed]
|
|
public function captureDate() : Carbon {
|
|
return Carbon::parse($this->capture_date_string);
|
|
}
|
|
|
|
public function mount(Category $category) : void {
|
|
$this->category = $category;
|
|
}
|
|
|
|
public function save() : void {
|
|
$this->validate();
|
|
}
|
|
|
|
public function render()
|
|
{
|
|
return view('livewire.drawer.album.create');
|
|
}
|
|
}
|