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.
PHP coolifydatabasesdeploymentdockerdocker-composeinertiajslaravelmariadbmysqlnextjsnodejsphppostgresredisself-hostedself-hostingserverstatic-sitesveltesvelte5
forms
Andras Bacsaid6c725ea8333
diff --git a/app/Http/Livewire/ApplicationForm.php b/app/Http/Livewire/ApplicationForm.phpindex 80c319a256..dc1d2d5721 100644--- a/app/Http/Livewire/ApplicationForm.php+++ b/app/Http/Livewire/ApplicationForm.php@@ -15,7 +15,11 @@ class ApplicationForm extends Componentpublic string $git_branch;public string|null $git_commit_sha;- public function mount() {+ protected $rules = [+ 'name' => 'required|min:6'+ ];+ public function mount()+ {$this->application = Application::find($this->applicationId);$this->fill(['name' => $this->application->name,@@ -25,5 +29,9 @@ class ApplicationForm extends Component'git_commit_sha' => $this->application->git_commit_sha,]);}-+ public function submit()+ {+ $this->validate();+ dd($this->name);+ }}diff --git a/app/View/Components/Input.php b/app/View/Components/Input.phpnew file mode 100644index 0000000000..e907fd0245--- /dev/null+++ b/app/View/Components/Input.php@@ -0,0 +1,26 @@+<?php++namespace App\View\Components;++use Closure;+use Illuminate\Contracts\View\View;+use Illuminate\View\Component;++class Input extends Component+{+ /**+ * Create a new component instance.+ */+ public function __construct(public string $name, public bool $required = false)+ {+ //+ }++ /**+ * Get the view / contents that represent the component.+ */+ public function render(): View|Closure|string+ {+ return view('components.input');+ }+}diff --git a/resources/views/components/input.blade.php b/resources/views/components/input.blade.phpnew file mode 100644index 0000000000..d1fcbf57ca--- /dev/null+++ b/resources/views/components/input.blade.php@@ -0,0 +1,6 @@+<label for={{ $name }}>{{ $name }}</label>+<input id={{ $name }} wire:model={{ $name }} type="text" name={{ $name }}+ {{ $required }} />+@error($name)+ <span class="text-red-500">{{ $message }}</span>+@enderrordiff --git a/resources/views/livewire/application-form.blade.php b/resources/views/livewire/application-form.blade.phpindex e2770fbeaf..c42b624545 100644--- a/resources/views/livewire/application-form.blade.php+++ b/resources/views/livewire/application-form.blade.php@@ -1,15 +1,12 @@<div>- <form class="flex flex-col">- <label>Name</label>- <input wire:model="name" type="text" name="name" />- <label>Fqdn</label>- <input wire:model="fqdn" type="text" name="fqdn" />- <label>Repository</label>- <input wire:model="git_repository" type="text" name="git_repository" />- <label>Branch</label>- <input wire:model="git_branch" type="text" name="git_branch" />- <label>Commit SHA</label>- <input wire:model="git_commit_sha" type="text" name="git_commit_sha" />-+ <form wire:submit.prevent='submit' class="flex flex-col">+ <x-input name="name" required="true" />+ <x-input name="fqdn" />+ <x-input name="git_repository" />+ <x-input name="git_branch" />+ <x-input name="git_commit_sha" />+ <button type="submit">+ Submit+ </button></form></div>