Exemplo n.º 1
0
 /**
  * Display a listing of the resource.
  *
  * @return \Illuminate\Http\Response
  */
 public function findAll()
 {
     $token = Input::get('token', '');
     if ($token != '') {
         $compare = GlobalLibrary::compareToken($token);
         if ($compare) {
             $dataAll = table_users_group::where('users_group_is_public', '=', 1)->get();
             $dataConverted = array();
             $app = app();
             $i = 0;
             foreach ($dataAll as $row) {
                 $dataConverted[$i] = $app->make('stdClass');
                 $dataConverted[$i]->i = $row->users_group_id;
                 $dataConverted[$i]->t = $row->users_group_name;
                 $dataConverted[$i]->d = $row->users_group_description;
                 $i++;
             }
             return (new Response(array('status' => true, 'data' => $dataConverted), 200))->header('Content-Type', "json");
         } else {
             return (new Response(array('status' => false, 'msg' => 'Authentication Failed'), 200))->header('Content-Type', "json");
         }
     } else {
         return (new Response(array('status' => false, 'msg' => 'Authentication Failed'), 200))->header('Content-Type', "json");
     }
 }
Exemplo n.º 2
0
 /**
  * Show the application dashboard to the user.
  *
  * @return Response
  */
 public function index()
 {
     if (!isset($is_public)) {
         $user_id = Auth::id();
         $cek = DB::table('table_users_detail')->where('users_id', '=', $user_id)->first();
         $user = table_users_detail::where('users_id', '=', $user_id)->first();
         $group = table_users_group::where('users_group_id', '=', $user->users_group_id)->first();
         $is_public = $group->users_group_is_public;
     }
     if ($is_public == "0") {
         session(['is_public' => 'yes']);
         return redirect('admin/dashboard');
     } else {
         echo "<center><h1>HOME</h1>You are not an ADMIN, <br/>\n\t\t\t\tYou redirected to HOME page that corresponds to your authentication.<br/> This page is under construction</center>";
         die;
     }
     // if($cek->users_group_id == 1 ){
     // 	return redirect('admin/dashboard');
     // }
     // else if($cek->users_group_id == 2 ){
     // 	return redirect('admin/dashboard');
     // }
     // else if($cek->users_group_id == 3 ){
     // 	echo "You are logged in as Content Writer. Your page is under construction";
     // 	die();
     // }
     // else if($cek->users_group_id == 4 ){
     // 	echo "You are logged in as Jamaah. Your page is under construction";
     // 	die();
     // }
     // else if($cek->users_group_id == 5 ){
     // 	echo "You are logged in as Ustadz. Your page is under construction";
     // 	die();
     // }
     // else if($cek->users_group_id == 6 ){
     // 	echo "You are logged in as Masjid. Your page is under construction";
     // 	die();
     // }
 }
Exemplo n.º 3
0
 /**
  * Remove the specified resource from storage.
  *
  * @param  int  $id
  * @return \Illuminate\Http\Response
  */
 public function destroy($id)
 {
     table_users_group::find($id)->delete();
     return redirect('admin/users-group')->with('warning', 'Data have been removed!');
 }