WIP
This commit is contained in:
39
app/Livewire/Drawer/Album/Create.php
Normal file
39
app/Livewire/Drawer/Album/Create.php
Normal file
@@ -0,0 +1,39 @@
|
||||
<?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');
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user