當前位置: 首頁>>代碼示例>>PHP>>正文


PHP Role::get方法代碼示例

本文整理匯總了PHP中app\Role::get方法的典型用法代碼示例。如果您正苦於以下問題:PHP Role::get方法的具體用法?PHP Role::get怎麽用?PHP Role::get使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在app\Role的用法示例。


在下文中一共展示了Role::get方法的11個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。

示例1: dashboard

 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);
 }
開發者ID:jamiehoward,項目名稱:scavenger,代碼行數:8,代碼來源:AdminController.php

示例2: getEdit

 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'));
     }
 }
開發者ID:hramose,項目名稱:laravel5-admin-1,代碼行數:9,代碼來源:UsersController.php

示例3: edit

 /**
  * 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);
 }
開發者ID:emitategh,項目名稱:aabcehmt,代碼行數:15,代碼來源:UserController.php

示例4: index

 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'));
 }
開發者ID:Shoodey,項目名稱:Events,代碼行數:13,代碼來源:DashboardController.php

示例5: down

 /**
  * 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();
     }
 }
開發者ID:davidvarney,項目名稱:tagmovement,代碼行數:20,代碼來源:2016_03_09_170606_add_station_data_permissions_to_permissions_table.php

示例6: anyUserSettings

	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;
		}
	}
開發者ID:kamitori,項目名稱:khuongnhi2,代碼行數:17,代碼來源:SettingsController.php

示例7: index

 /**
  * Show the application dashboard.
  *
  * @return Response
  */
 public function index()
 {
     $roles = Role::get();
     return view('entrust.roles.index', compact('roles'));
 }
開發者ID:decalages,項目名稱:ct-base,代碼行數:10,代碼來源:RolesController.php

示例8: getIndex

 public function getIndex()
 {
     $listData = Role::get();
     return View('app.roles.list', ['listData' => $listData]);
 }
開發者ID:hramose,項目名稱:laravel5-admin-1,代碼行數:5,代碼來源:RolesController.php

示例9: index

 /**
  * 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']);
 }
開發者ID:meccado,項目名稱:acl-admin-control-panel,代碼行數:10,代碼來源:RoleController.php

示例10: index

 /**
  * 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'));
 }
開發者ID:Shoodey,項目名稱:Events,代碼行數:11,代碼來源:RolesController.php

示例11: update

 /**
  * 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('/');
     }
 }
開發者ID:ryujikun,項目名稱:bridge,代碼行數:85,代碼來源:AccountController.php


注:本文中的app\Role::get方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。