lasthourcloud/app/Http/Livewire/Project/Edit.php
Andras Bacsai da4c2ee60f fix: boarding
fix: error handling
fix: restarting state
2023-09-15 15:34:25 +02:00

27 lines
540 B
PHP

<?php
namespace App\Http\Livewire\Project;
use App\Models\Project;
use Livewire\Component;
class Edit extends Component
{
public Project $project;
protected $rules = [
'project.name' => 'required|min:3|max:255',
'project.description' => 'nullable|string|max:255',
];
public function submit()
{
$this->validate();
try {
$this->project->save();
$this->emit('saved');
} catch (\Throwable $e) {
return handleError($e, $this);
}
}
}