coolify/app/Livewire/Project/Edit.php
2023-12-07 19:06:32 +01:00

27 lines
539 B
PHP

<?php
namespace App\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->dispatch('saved');
} catch (\Throwable $e) {
return handleError($e, $this);
}
}
}