当前位置: 首页>>代码示例>>PHP>>正文


PHP User::get方法代码示例

本文整理汇总了PHP中app\models\User::get方法的典型用法代码示例。如果您正苦于以下问题:PHP User::get方法的具体用法?PHP User::get怎么用?PHP User::get使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在app\models\User的用法示例。


在下文中一共展示了User::get方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: getIndex

 public function getIndex(Request $request)
 {
     $Model = new User();
     $Total = $Model->get()->count();
     $Model = $Model->orderBy('id', 'DESC');
     $data = $this->paging($Model, $request);
     $totals = ['total' => $Total];
     return $this->ResponseData($data, $totals);
 }
开发者ID:dao94,项目名称:game,代码行数:9,代码来源:AccountController.php

示例2: authenticate

 public static function authenticate(User $user)
 {
     $data = $user->get(["username" => $user->getUsername(), "password" => $user->getPassword()])->First();
     if ($data != null) {
         \Framework\Http\Session::instance()->Add("authenticated", true);
         \Framework\Http\Session::instance()->Add("userId", $data->getId());
         \Framework\Http\Session::instance()->Add("username", $data->getUsername());
     }
 }
开发者ID:PatrickFarnkopf,项目名称:survey,代码行数:9,代码来源:Authentication.php

示例3: validate

 /**
  * This validation is not great, but good enough. The Session
  * environment has already been validated, so all you need is a
  * valid user ID.
  */
 public function validate()
 {
     $login = parent::validate();
     if (is_array($login) && isset($login['user_id'], $login['salt'])) {
         try {
             $this->save(array('user' => models\User::get($login['user_id']), 'salt' => $login['salt']));
         } catch (Exception $ex) {
         }
     }
 }
开发者ID:rudiedirkx,项目名称:SocialPay,代码行数:15,代码来源:SessionUser.php

示例4: run

 /**
  * Run the database seeds.
  *
  * @return void
  */
 public function run()
 {
     if (Role::get()->count() == 0) {
         Role::create(['name' => 'admin', 'display_name' => 'Admin', 'description' => 'User can adminstrate the site']);
         Role::create(['name' => 'user', 'display_name' => 'User', 'description' => 'User can navigate the site']);
     }
     if (User::get()->count() == 0) {
         User::create(['name' => env('ROOT_USER_NAME', 'Test User'), 'email' => env('ROOT_USER_EMAIL', 'testuser@test.com'), 'password' => Hash::make(env('ROOT_USER_PASSWORD', 'password'))])->attachRole(Role::where('name', '=', 'admin')->first());
     }
 }
开发者ID:nich-mctishe,项目名称:laravel-framework,代码行数:15,代码来源:UsersTableSeeder.php

示例5: check

 /**
  * Check if a user is logged in for the given portal
  */
 public static function check()
 {
     if (Session::has('user_id')) {
         $user = User::get();
         if ($user) {
             return TRUE;
         }
     }
     return FALSE;
 }
开发者ID:rniocena,项目名称:cms-manage,代码行数:13,代码来源:User.php

示例6: listUsers

 public function listUsers()
 {
     if ($this->auth->check()) {
         if (in_array($this->auth->user()->role, ['admin', 'judge', 'observer'])) {
             $users = User::get();
             return view('pages/users/list', compact('users'));
         }
     }
     return redirect('');
 }
开发者ID:playatech,项目名称:weightlifter,代码行数:10,代码来源:UserController.php

示例7: handle

 /**
  * Handle the event.
  *
  * @param  NewDiaryEvent  $event
  * @return void
  */
 public function handle(NewDiaryEvent $event)
 {
     $diary = $event->diary;
     $users = User::get(['id', 'name', 'email']);
     foreach ($users as $user) {
         $user = $user->toArray();
         Mail::queue('email.new_diary', ['diary' => $diary->toArray(), 'author' => $diary->user->toArray(), 'user' => $user], function ($m) use($user) {
             $m->to($user['email'], $user['name'])->subject("A new diary was published! Welcome to nahid.co ");
         });
     }
 }
开发者ID:nahid,项目名称:nahid.co,代码行数:17,代码来源:SendMailAllUsersListener.php

示例8: anyIndex

 public function anyIndex()
 {
     $user_id = NULL;
     if (User::check()) {
         $user_id = User::get()->id;
     }
     $website_views = new WebsiteViews();
     $website_views->user_id = $user_id;
     $website_views->save();
     return View::make('home.home');
 }
开发者ID:rniocena,项目名称:cms-manage,代码行数:11,代码来源:HomeController.php

示例9: validate

 public function validate()
 {
     $login = parent::validate();
     if (is_array($login) && isset($login['user_id'], $login['salt'])) {
         try {
             $this->user = models\User::get($login['user_id'], array('unicheck' => $login['unicheck']));
             $this->salt = $login['salt'];
             $this->user->update(array('last_access' => time()));
         } catch (Exception $ex) {
             $this->logout();
         }
     }
 }
开发者ID:rudiedirkx,项目名称:openid_app,代码行数:13,代码来源:SessionUser.php

示例10: delete

 public function delete()
 {
     if ($this->request->id) {
         $user = User::get($this->request->id);
         $user->delete();
         $this->message('Success to delete User');
         $this->redirect('Users::index');
         return true;
     }
     $this->message('User id cannot be empty');
     $this->redirect($this->request->referer());
     return false;
 }
开发者ID:ncud,项目名称:sagalaya,代码行数:13,代码来源:UsersController.php

示例11: __construct

 public function __construct()
 {
     // Require that the user is a guest (logged out)
     $this->middleware('guest', ['only' => ['getLogin', 'postLogin']]);
     // Require that the user is logged in
     $this->middleware('auth', ['only' => ['getLogout', 'getProfile']]);
     if (User::get()) {
         //            $this->roles = User::get()->checkRole(Seller::get()->id, User::get()->id);
         $this->super_admin = User::get()->isSuperAdmin(User::$user->id);
     }
     //        View::share('user_roles', $this->roles);
     View::share('super_admin', $this->super_admin);
 }
开发者ID:rniocena,项目名称:cms-manage,代码行数:13,代码来源:ContactController.php

示例12: bind

 public function bind($user_id)
 {
     $user = User::get($user_id);
     if (!$user) {
         throw new NotFoundHttpException();
     } else {
         return $user;
     }
     // $sid = Input::get('sid');
     // if (!$this->isValid($user_id, $sid)) {
     //     throw new NotFoundHttpException;
     // }
     // return User::get($user_id);
 }
开发者ID:hncg,项目名称:watermelon,代码行数:14,代码来源:Auth.php

示例13: findAdmins

/**
 * Get list (collection) of Admin(s)
 */
function findAdmins($field = 'all')
{
    $users = User::get();
    $admins = [];
    foreach ($users as $user) {
        if ($user->isAdmin()) {
            if ($field == 'all') {
                array_push($admins, $user);
            } else {
                array_push($admins, $user[$field]);
            }
        }
    }
    return $admins;
}
开发者ID:matthiku,项目名称:cSpot,代码行数:18,代码来源:helpers.php

示例14: postSetup

 /**
  * Get the setup page.
  *
  * @return View
  */
 protected function postSetup(Request $request)
 {
     $user = User::get()->first();
     if ($user) {
         abort('403', 'Setup already finished');
     }
     $validator = Validator::make($request->all(), ['name' => 'required', 'email' => 'required|email|unique:users,email', 'cas_username' => 'unique:users,cas_username', 'password' => 'required|min:8']);
     if ($validator->fails()) {
         return Redirect::action('Pages\\PageController@getSetup')->withInput()->withErrors($validator);
     }
     $user = new User();
     $user->name = $request->name;
     $user->email = $request->email;
     $user->password = Hash::make($request->password);
     $user->cas_username = $request->cas_username;
     $user->super_admin = true;
     $user->save();
     return Redirect::action('User\\UserController@getDashboard', $user->id)->with('status', 'Setup finished');
 }
开发者ID:flyapen,项目名称:v-observer,代码行数:24,代码来源:PageController.php

示例15: run

 /**
  * Run the database seeds.
  *
  * @return void
  */
 public function run()
 {
     Conversation::truncate();
     DB::table('conversation_user')->truncate();
     $users = User::get();
     foreach ($users as $user) {
         for ($i = 0, $count = rand(0, 5); $i < $count; $i++) {
             $rUser = $users->random();
             while ($rUser == $user) {
                 $rUser = $users->random();
             }
             $conversation = $user->conversations->intersect($rUser->conversations);
             if ($conversation->isEmpty()) {
                 $conversation = Conversation::create();
                 $conversation->users()->saveMany([$user, $rUser]);
             }
         }
     }
 }
开发者ID:gultaj,项目名称:react-tutorial-backend,代码行数:24,代码来源:ConversationsTableSeeder.php


注:本文中的app\models\User::get方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。