coolify/app/Livewire/Project/AddEmpty.php

33 lines
754 B
PHP
Raw Normal View History

<?php
2023-12-07 18:06:32 +00:00
namespace App\Livewire\Project;
use App\Models\Project;
use Livewire\Attributes\Validate;
use Livewire\Component;
class AddEmpty extends Component
{
#[Validate(['required', 'string', 'min:3'])]
2024-11-03 22:42:00 +00:00
public string $name;
2024-06-10 20:43:34 +00:00
#[Validate(['nullable', 'string'])]
public string $description = '';
2024-06-10 20:43:34 +00:00
public function submit()
{
try {
$this->validate();
$project = Project::create([
'name' => $this->name,
'description' => $this->description,
2023-08-22 15:44:49 +00:00
'team_id' => currentTeam()->id,
]);
2024-06-10 20:43:34 +00:00
2023-12-27 15:45:01 +00:00
return redirect()->route('project.show', $project->uuid);
2023-09-11 15:36:30 +00:00
} catch (\Throwable $e) {
return handleError($e, $this);
}
}
}