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


PHP Role::select方法代碼示例

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


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

示例1: all

 public function all($params)
 {
     $params['order'] = isset($params['order']) ? $params['order'] : ['display_name|ASC'];
     $roles = Role::select("roles.*");
     $roles = parent::execute($roles, $params);
     return $roles;
 }
開發者ID:pinkynrg,項目名稱:convergence2.0,代碼行數:7,代碼來源:RolesController.php

示例2: create

 public function create()
 {
     $roles = Role::select('id', 'role_name')->get();
     $roles = $this->toOptionArray($roles);
     //dd($roles);
     return view($this->view_path . 'create', compact('roles', 'data'));
 }
開發者ID:nutsdo,項目名稱:nong-store,代碼行數:7,代碼來源:AdminController.php

示例3: run

 /**
  * Run the database seeds.
  *
  * @return void
  */
 public function run()
 {
     $role = Role::select('id')->where('name', '=', 'admin')->first();
     $user = User::create(['name' => 'Administrador', 'lastname' => 'Administrador', 'email' => 'admin@admin.com', 'password' => bcrypt('admin'), 'dni' => '34785999', 'state_id' => '12', 'city_id' => '228', 'role_id' => $role->id, 'active' => '1']);
     $role = Role::select('id')->where('name', '=', 'user')->first();
     $user = User::create(['name' => 'User', 'lastname' => 'User', 'email' => 'user@user.com', 'password' => bcrypt('123456'), 'dni' => '34785998', 'state_id' => '12', 'city_id' => '228', 'role_id' => $role->id, 'active' => '1']);
 }
開發者ID:mauhftw,項目名稱:mizustats,代碼行數:12,代碼來源:UsersSeeder.php

示例4: update

 public static function update(UserRequest $request, $id)
 {
     $user = User::find($id);
     if (!$user) {
         return redirect()->back()->withErrors('No se encontro el usuario solicitado');
     }
     $role = Role::select('name', 'id')->where('id', '=', $request->input('role_id'))->first();
     if ($role->name == 'Admin') {
         //Admin
         $user->role_id = $role->id;
     } else {
         //Client
         $client = Role::select('id')->where('name', '=', 'User')->first();
         //$token = str_random(32);
         $user->role_id = $client->id;
         //$user->active = 0;
     }
     if (!$request->has('active')) {
         //check checkbox :D
         $user->active = 0;
     } else {
         $user->active = $request->input('active');
     }
     $user->password = Hash::make($request->input('password'));
     $user->name = $request->input('name');
     $user->lastname = $request->input('lastname');
     $user->email = $request->input('email');
     $user->dni = $request->input('dni');
     $user->state_id = $request->input('state_id');
     $user->city_id = $request->input('city_id');
     $user->save();
     return redirect()->route('users.index')->with('success', 'El usuario se ha modificado correctamente');
 }
開發者ID:mauhftw,項目名稱:mizustats,代碼行數:33,代碼來源:UsersController.php

示例5: onDelete

 /**
  * Function Remove
  * Process Delete the Brand Data
  *
  * @return \Illuminate\Http\JsonResponse
  */
 public function onDelete()
 {
     $id = Input::get('id');
     $Model = \App\Models\Role::select(['id'])->where('id', $id)->first();
     if ($Model) {
         \App\Models\Role::where('id', $id)->delete();
         $param['message'] = Lang::get('info.has deleted');
         $param['error'] = false;
     } else {
         $param['message'] = Lang::get('info.has error');
         $param['error'] = true;
     }
     return json_encode($param);
 }
開發者ID:suhe,項目名稱:bdoportal,代碼行數:20,代碼來源:RoleController.php


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