2023-06-22 07:33:26 +00:00
|
|
|
<?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',
|
|
|
|
];
|
2023-06-22 13:25:57 +00:00
|
|
|
|
2023-06-22 07:33:26 +00:00
|
|
|
public function submit()
|
|
|
|
{
|
|
|
|
$this->validate();
|
|
|
|
try {
|
|
|
|
$this->project->save();
|
|
|
|
$this->emit('saved');
|
2023-09-11 15:36:30 +00:00
|
|
|
} catch (\Throwable $e) {
|
2023-06-22 07:33:26 +00:00
|
|
|
return general_error_handler($e, $this);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|