authentikate/app/Livewire/Forms/NewApplication.php
Javier Feliz eeb6b4bc0e
Some checks failed
tests / ci (push) Waiting to run
linter / quality (push) Has been cancelled
Initial commit
2025-07-27 02:31:34 -04:00

37 lines
813 B
PHP

<?php
namespace App\Livewire\Forms;
use App\Models\Application;
use Livewire\Attributes\Validate;
use Illuminate\Support\Str;
use Livewire\Component;
class NewApplication extends Component
{
#[Validate('required')]
public string $name = '';
#[Validate('required|url')]
public string $redirect_uri = '';
public function create()
{
$this->validate();
Application::create([
'name' => $this->name,
'redirect_uri' => $this->redirect_uri,
'client_id' => Str::uuid()->toString(),
'client_secret' => Str::random(40),
]);
$this->reset(['name', 'redirect_uri']);
return redirect(route('dashboard'));
}
public function render()
{
return view('livewire.forms.new-application');
}
}