add team delte
CI/CD / test_and_check_app (push) Failing after 55s
CI/CD / Publish immutable image (push) Skipped

This commit is contained in:
2026-09-29 21:39:26 +02:00
parent f6831a02a2
commit 0ea78a621a
7 changed files with 57 additions and 20 deletions
+12 -1
View File
@@ -53,7 +53,7 @@ class TeamController extends Controller
try {
DB::transaction(function () use ($request): void {
$team = Team::create($request->validated());
$team->members()->attach($request->user(), ['role' => TeamMemberRole::Admin]);
$team->members()->attach($request->user(), ['role' => TeamMemberRole::Owner]);
});
} catch (\Exception $exception) {
report($exception);
@@ -100,6 +100,17 @@ class TeamController extends Controller
return to_route('teams.show', $team);
}
public function destroy(Request $request, Team $team)
{
try {
$team->delete();
} catch (\Exception $exception) {
report($exception);
Inertia::flash('error', 'Team could not be deleted.');
}
Inertia::flash('success', 'Team successfully deleted.');
}
public function nameToSlug(Request $request): JsonResponse
{