refactor new project

This commit is contained in:
Andras Bacsai
2024-11-03 23:42:00 +01:00
parent 1bdc2c6d7c
commit 8854eeb911
2 changed files with 6 additions and 14 deletions

View File

@@ -3,24 +3,17 @@
namespace App\Livewire\Project;
use App\Models\Project;
use Livewire\Attributes\Rule;
use Livewire\Component;
class AddEmpty extends Component
{
public string $name = '';
#[Rule(['required', 'string', 'min:3'])]
public string $name;
#[Rule(['nullable', 'string'])]
public string $description = '';
protected $rules = [
'name' => 'required|string|min:3',
'description' => 'nullable|string',
];
protected $validationAttributes = [
'name' => 'Project Name',
'description' => 'Project Description',
];
public function submit()
{
try {
@@ -34,8 +27,6 @@ class AddEmpty extends Component
return redirect()->route('project.show', $project->uuid);
} catch (\Throwable $e) {
return handleError($e, $this);
} finally {
$this->name = '';
}
}
}