2023-06-16 13:01:58 +00:00
|
|
|
<?php
|
|
|
|
|
|
|
|
namespace App\Http\Livewire\Team;
|
|
|
|
|
|
|
|
use App\Models\Team;
|
|
|
|
use Livewire\Component;
|
|
|
|
|
|
|
|
class Form extends Component
|
|
|
|
{
|
|
|
|
public Team $team;
|
|
|
|
protected $rules = [
|
|
|
|
'team.name' => 'required|min:3|max:255',
|
|
|
|
'team.description' => 'nullable|min:3|max:255',
|
|
|
|
];
|
|
|
|
protected $validationAttributes = [
|
|
|
|
'team.name' => 'name',
|
|
|
|
'team.description' => 'description',
|
|
|
|
];
|
2023-08-08 09:51:36 +00:00
|
|
|
|
2023-06-16 13:01:58 +00:00
|
|
|
public function mount()
|
|
|
|
{
|
2023-08-22 15:44:49 +00:00
|
|
|
$this->team = currentTeam();
|
2023-06-16 13:01:58 +00:00
|
|
|
}
|
2023-08-08 09:51:36 +00:00
|
|
|
|
2023-06-16 13:01:58 +00:00
|
|
|
public function submit()
|
|
|
|
{
|
|
|
|
$this->validate();
|
|
|
|
try {
|
|
|
|
$this->team->save();
|
2023-09-15 15:30:26 +00:00
|
|
|
refreshSession();
|
2023-09-11 15:36:30 +00:00
|
|
|
} catch (\Throwable $e) {
|
2023-09-15 13:34:25 +00:00
|
|
|
return handleError($e, $this);
|
2023-06-16 13:01:58 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|