/** * Delete the specified group * * @param Group $group * @return \Illuminate\Http\RedirectResponse|\Illuminate\Routing\Redirector * @throws \Exception */ public function destroy(Group $group) { $this->authorize('edit_users'); $group->delete(); flash()->success('Group Deleted', 'The group has been removed'); return redirect('group'); }
/** * @param Group $Group * @return \Illuminate\Http\RedirectResponse|\Illuminate\Routing\Redirector */ public function destroy(Group $Group) { if ($count = $Group->users->count()) { return redirect(route('admin.groups.list'))->with('error', "В группе есть пользователи ({$count})"); } $Group->delete(); return redirect(route('admin.groups.list')); }