add team delte
This commit is contained in:
@@ -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
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user