refactor new project
This commit is contained in:
@@ -3,24 +3,17 @@
|
|||||||
namespace App\Livewire\Project;
|
namespace App\Livewire\Project;
|
||||||
|
|
||||||
use App\Models\Project;
|
use App\Models\Project;
|
||||||
|
use Livewire\Attributes\Rule;
|
||||||
use Livewire\Component;
|
use Livewire\Component;
|
||||||
|
|
||||||
class AddEmpty extends Component
|
class AddEmpty extends Component
|
||||||
{
|
{
|
||||||
public string $name = '';
|
#[Rule(['required', 'string', 'min:3'])]
|
||||||
|
public string $name;
|
||||||
|
|
||||||
|
#[Rule(['nullable', 'string'])]
|
||||||
public string $description = '';
|
public string $description = '';
|
||||||
|
|
||||||
protected $rules = [
|
|
||||||
'name' => 'required|string|min:3',
|
|
||||||
'description' => 'nullable|string',
|
|
||||||
];
|
|
||||||
|
|
||||||
protected $validationAttributes = [
|
|
||||||
'name' => 'Project Name',
|
|
||||||
'description' => 'Project Description',
|
|
||||||
];
|
|
||||||
|
|
||||||
public function submit()
|
public function submit()
|
||||||
{
|
{
|
||||||
try {
|
try {
|
||||||
@@ -34,8 +27,6 @@ class AddEmpty extends Component
|
|||||||
return redirect()->route('project.show', $project->uuid);
|
return redirect()->route('project.show', $project->uuid);
|
||||||
} catch (\Throwable $e) {
|
} catch (\Throwable $e) {
|
||||||
return handleError($e, $this);
|
return handleError($e, $this);
|
||||||
} finally {
|
|
||||||
$this->name = '';
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,7 +1,8 @@
|
|||||||
<form class="flex flex-col w-full gap-2 rounded" wire:submit='submit'>
|
<form class="flex flex-col w-full gap-2 rounded" wire:submit='submit'>
|
||||||
<x-forms.input placeholder="Your Cool Project" id="name" label="Name" required />
|
<x-forms.input placeholder="Your Cool Project" id="name" label="Name" required />
|
||||||
<x-forms.input placeholder="This is my cool project everyone knows about" id="description" label="Description" />
|
<x-forms.input placeholder="This is my cool project everyone knows about" id="description" label="Description" />
|
||||||
<div class="subtitle">New project will have a default production environment.</div>
|
<div class="subtitle">New project will have a default <span class="dark:text-warning font-bold">production</span>
|
||||||
|
environment.</div>
|
||||||
<x-forms.button type="submit" @click="slideOverOpen=false">
|
<x-forms.button type="submit" @click="slideOverOpen=false">
|
||||||
Continue
|
Continue
|
||||||
</x-forms.button>
|
</x-forms.button>
|
||||||
|
|||||||
Reference in New Issue
Block a user