Skip to content

An open-source, self-hostable PaaS alternative to Vercel, Heroku & Netlify that lets you easily deploy static sites, databases, full-stack applications and 360+ one-click services on your own servers.

refactor new project

Andras Bacsai8854eeb911d0
diff --git a/app/Livewire/Project/AddEmpty.php b/app/Livewire/Project/AddEmpty.php
index c3353be848..c8c063960c 100644
--- a/app/Livewire/Project/AddEmpty.php
+++ b/app/Livewire/Project/AddEmpty.php
@@ -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 = '';
}
}
}
diff --git a/resources/views/livewire/project/add-empty.blade.php b/resources/views/livewire/project/add-empty.blade.php
index 67953f2197..962376df19 100644
--- a/resources/views/livewire/project/add-empty.blade.php
+++ b/resources/views/livewire/project/add-empty.blade.php
@@ -1,7 +1,8 @@
<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="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">
Continue
</x-forms.button>