public function dashboard(Request $request) { $this->data['teams'] = \App\Team::with('points')->get(); $this->data['roles'] = \App\Role::get(); $this->data['adminUser'] = \App\User::find(1); $this->data['users'] = \App\User::where('id', '>', 1)->with('points')->get()->sortByDesc('amount'); return View::make('admin.dashboard', $this->data); }
public function getEdit($id) { if ($user = User::find($id)) { $roles = Role::get(); return View('app.users.edit', ['roles' => $roles, 'user' => $user]); } else { return redirect()->route('users.index')->with('errorMsg', trans('app.record_not_found')); } }
/** * Show the form for editing the specified resource. * * @param int $id * @return Response */ public function edit($id) { $whereAmI = $this->ruta . $this->listOneBreadcrumb('editar usuario', '', 1); $this->webpage['routes'] = json_encode(getUriByController()); $user = User::findOrFail($id); $roles = Role::get()->lists('display_name', 'id'); $this->data = array_merge(['whereAmI' => $whereAmI, 'webpage' => $this->webpage, 'user' => $user, 'roles' => $roles], $this->data); return view('admin.users.edit', $this->data); }
public function index() { $tab = 'dashboard'; $users = User::get(); $usersCount = $users->count(); $activeUsers = $users->where('active', 1)->count(); $inactiveUsers = $usersCount - $activeUsers; $roles = Role::get(); $rolesCount = $roles->count(); $usersWithRole = DB::table('role_user')->count(); $permissionsCount = Permission::get()->count(); return view('admin.dashboard', compact('tab', 'usersCount', 'activeUsers', 'inactiveUsers', 'rolesCount', 'usersWithRole', 'permissionsCount')); }
/** * Reverse the migrations. * * @return void */ public function down() { $new_permissions = array('can_edit_station_data', 'can_add_station_data', 'can_delete_station_data', 'can_view_station_data'); $roles = Role::get(); $permissions = Permission::whereIn('name', $new_permissions)->get(); $permission_ids = $permissions->lists('id'); // First detach the permissions from the roles foreach ($roles as $role) { $role->detachPermissions($permission_ids); } // Now delete the permission altogether foreach ($permissions as $permission) { $permission->delete(); } }
public function anyUserSettings(Request $request) { $users = User::select('users.*','roles.display_name as type_name','roles.id as type_id') ->leftJoin('role_user',function($join){ $join->on("users.id","=","role_user.user_id"); }) ->leftJoin('roles','role_user.role_id','=','roles.id'); $users = $users->paginate(5); $user_types = Role::get()->toArray(); $view = view('setting.list-user',['user_types' => $user_types,'users'=>$users]); if( $request->ajax() ) { return $view; } else { $this->layout->content = $view; } }
/** * Show the application dashboard. * * @return Response */ public function index() { $roles = Role::get(); return view('entrust.roles.index', compact('roles')); }
public function getIndex() { $listData = Role::get(); return View('app.roles.list', ['listData' => $listData]); }
/** * Display a listing of the resource. * * @return \Illuminate\View\View */ public function index() { $roles = $this->roles->get(); return \View::make('admin.roles.index', ['roles' => $roles, 'title' => 'list']); }
/** * Display a listing of the resource. * * @return \Illuminate\Http\Response */ public function index() { $roles = Role::get(); $tab = 'roles'; return view('admin.roles.index', compact('roles', 'tab')); }
/** * Update the specified resource in storage. * * @param Request $request * @param int $id * @return Response */ public function update($id) { if (Auth::user()->role_id == 1) { if (Request::isMethod('get')) { $this->data = array(); $this->data['user'] = User::find($id); $this->data['role'] = Role::get(); return View::make('admin.users.update', $this->data); } else { if (Request::isMethod('post')) { $data = Input::all(); date_default_timezone_set('Asia/Jakarta'); // CDT $current_date = date('Y-m-d'); if (empty($_FILES['imginp']['name'])) { $target_file_final = $data['img_temp']; } else { $name = $_FILES['imginp']['name']; $test = pathinfo($name, PATHINFO_FILENAME); $target_dir = "artikel/"; $original_name = $test; $imageFileType = pathinfo($name, PATHINFO_EXTENSION); //$target_file = $target_dir . basename($_FILES["imginp"]["name"]); $uploadOk = 1; // Check if image file is a actual image or fake image if (isset($_POST["submit"])) { $check = getimagesize($_FILES["imginp"]["tmp_name"]); if ($check !== false) { echo "File is an image - " . $check["mime"] . "."; $uploadOk = 1; } else { echo "File is not an image."; $uploadOk = 0; } } if ($imageFileType != "jpg" && $imageFileType != "png" && $imageFileType != "jpeg" && $imageFileType != "gif") { echo "Sorry, only JPG, JPEG, PNG & GIF files are allowed."; $uploadOk = 0; } // Check if file already exists $i = 1; while (file_exists($target_dir . $test . "." . $imageFileType)) { $test = (string) $original_name . $i; $name = $test . "." . $imageFileType; $i++; } $target_file = $target_dir . $name; // Check file size if ($_FILES["imginp"]["size"] > 500000) { echo "Sorry, your file is too large."; $uploadOk = 0; } // Allow certain file formats // Check if $uploadOk is set to 0 by an error if ($uploadOk == 0) { echo "Sorry, your file was not uploaded."; // if everything is ok, try to upload file } else { if (move_uploaded_file($_FILES["imginp"]["tmp_name"], $target_file)) { echo "The file " . basename($_FILES["imginp"]["name"]) . " has been uploaded."; } else { echo "Sorry, there was an error uploading your file."; } } $target_file_final = "../" . $target_file; } /*else{ echo "adadsdsa"; break; }*/ User::where('id', $id)->update(array('nama' => $data['nama'], 'username' => $data['username'], 'gambar' => $target_file_final, 'role_id' => $data['role_id'])); return redirect('admin/users'); } } } else { return redirect('/'); } }