Ejemplo n.º 1
0
 /**
  * Show the application dashboard to the user.
  *
  * @return Response
  */
 public function index()
 {
     $userCount = User::where('id', '>=', 1)->count();
     $memberCount = Member::where('id', '>=', 1)->count();
     $charCount = Character::where('id', '>=', 1)->count();
     $data = ['user' => Auth::user(), 'sitename' => \Config::get('diablo.sitename'), 'dashboard' => ['counters' => ['users' => ['title' => 'Users', 'value' => $userCount, 'url' => ''], 'members' => ['title' => 'Members', 'value' => $memberCount, 'url' => ''], 'characters' => ['title' => 'Characters', 'value' => $charCount, 'url' => '']]]];
     return view('admin/index', $data);
 }
Ejemplo n.º 2
0
 public function deleteMember($id)
 {
     try {
         $member = Member::where('id', $id)->firstOrFail();
     } catch (\Exception $e) {
         return response('Bad Request.', 400);
     }
     /* Is Admin? */
     $user = Auth::user();
     if (!$user->isAdmin()) {
         return response('Unauthorized', 401);
     }
     $member->delete();
 }