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


PHP User::whereName方法代码示例

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


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

示例1: boot

 /**
  * Define your route model bindings, pattern filters, etc.
  *
  * @param  \Illuminate\Routing\Router  $router
  * @return void
  */
 public function boot(Router $router)
 {
     parent::boot($router);
     $router->bind('username', function ($username) {
         return User::whereName($username)->firstOrFail();
     });
 }
开发者ID:filipve,项目名称:Build-An-Activity-Feed-in-Laravel,代码行数:13,代码来源:RouteServiceProvider.php

示例2: test_a_user_may_register_for_an_account_but_must_confirm_their_email_address

 public function test_a_user_may_register_for_an_account_but_must_confirm_their_email_address()
 {
     $this->visit('register')->type('jhn', 'name')->type('j@example.com', 'email')->type('password', 'password')->press('Register');
     $this->see('Please Confirm your Email')->seeInDatabase('users', ['name' => 'jhn', 'verified' => 0]);
     $user = User::whereName('jhn')->first();
     //  $this->login($user)->see('Could Not Sign In');
     $this->visit("register/confirm/{$user->token}")->see('You are Now Verified Please Login')->seeInDatabase('users', ['name' => 'jhn', 'verified' => 1]);
 }
开发者ID:nirajanpoudel,项目名称:hrms,代码行数:8,代码来源:ed.php

示例3: a_user_may_register_for_an_account_but_must_confirm_their_email_address

 /**
  * A basic functional test example.
  *
  * @return void
  */
 public function a_user_may_register_for_an_account_but_must_confirm_their_email_address()
 {
     $this->visit('register')->type('JohnDoe', 'name')->type('john@example.com', 'email')->type('password', 'password')->press('Register');
     $this->see('Please confirm your email address')->seeInDatabase('users', ['name' => 'JohnDoe', 'verified' => 0]);
     $user = User::whereName('JohnDoe')->first();
     // $this->login($user)->see('Could not sign you in.');
     $this->visit("register/confirm/{$user->token}")->see('You are now confirmed. Please login.')->seeInDatabase('users', ['name' => 'JohnDoe', 'verified' => 1]);
 }
开发者ID:Owlnofeathers,项目名称:laravel.ajamesb.com,代码行数:13,代码来源:AuthTest.php

示例4: show

 /**
  * Display the specified resource.
  *
  * @param  int $id
  * @param \Slayerfat\PhoneParser\Interfaces\PhoneParserInterface $phoneParser
  * @return \Symfony\Component\HttpFoundation\Response
  */
 public function show($id, PhoneParserInterface $phoneParser)
 {
     $user = User::whereName($id)->first();
     if (!$user) {
         $user = User::findOrFail($id);
     }
     $user->load('personalDetails', 'personalDetails.professor', 'personalDetails.events');
     return View::make('users.show', compact('user', 'phoneParser'));
 }
开发者ID:slayerfat,项目名称:certificador,代码行数:16,代码来源:UsersController.php

示例5: show

 public function show($user, Post $post)
 {
     $user = User::whereName($user)->with('posts.votes')->with('comments.posts')->firstOrFail();
     $comments = $user->comments;
     $linkKarma = $user->votes()->sum('value');
     $commentKarma = $user->commentvotes()->sum('value');
     $total_comments = $user->comments->count();
     $isModerator = false;
     return view('user/profile')->with('user', $user)->with('linkKarma', $linkKarma)->with('commentKarma', $commentKarma)->with('comments', $comments)->with('total_comments', $total_comments)->with('isModerator', $isModerator);
 }
开发者ID:ReyRodriguez,项目名称:laravel-reddit,代码行数:10,代码来源:ProfilesController.php

示例6: run

 public function run()
 {
     DB::table('role_user')->delete();
     $user = User::whereName('corean')->FirstOrFail();
     $role_id = Role::whereName('manager')->pluck('id');
     $user->saveRoles([$role_id[0]]);
     $user = User::whereName('test')->FirstOrFail();
     $role_id = Role::whereName('member')->pluck('id');
     $user->saveRoles([$role_id[0]]);
 }
开发者ID:corean,项目名称:LearningLaravel,代码行数:10,代码来源:DatabaseSeeder.php

示例7: index

 public function index($userName)
 {
     $gallery_owner = User::whereName($userName)->firstOrFail();
     if (!Auth::check()) {
         return redirect('/uzivatel/' . $gallery_owner->id);
     }
     if (Auth::user()->name != $gallery_owner->name) {
         return redirect('/uzivatel/' . $gallery_owner->id);
     }
     return view('home')->with('author', Auth::user()->name);
 }
开发者ID:Baza58,项目名称:Gallery-App,代码行数:11,代码来源:HomeController.php

示例8: a_user_may_register_for_an_account_but_must_confirm_their_email_address

 /** @test */
 public function a_user_may_register_for_an_account_but_must_confirm_their_email_address()
 {
     // When we register...
     $this->visit('register')->type('JohnDoe', 'name')->type('john@example.com', 'email')->type('password', 'password')->press('Register');
     // We should have an account - but one that is not yet confirmed/verified.
     $this->see('Please confirm your email address.')->seeInDatabase('users', ['name' => 'JohnDoe', 'verified' => 0]);
     $user = User::whereName('JohnDoe')->first();
     // You can't login until you confirm your email address.
     $this->login($user)->see('Could not sign you in.');
     // Like this...
     $this->visit("register/confirm/{$user->token}")->see('You are now confirmed. Please login.')->seeInDatabase('users', ['name' => 'JohnDoe', 'verified' => 1]);
 }
开发者ID:abada,项目名称:Email-Verification-In-Laravel,代码行数:13,代码来源:AuthTest.php

示例9: boot

 /**
  * Define your route model bindings, pattern filters, etc.
  *
  * @param  \Illuminate\Routing\Router  $router
  * @return void
  */
 public function boot(Router $router)
 {
     // Route Bindings
     $router->bind('categories', function ($value) {
         return Category::whereSlug($value)->first();
     });
     $router->bind('posts', function ($value) {
         return Post::whereSlug($value)->first();
     });
     $router->bind('author', function ($value) {
         return User::whereName($value)->first();
     });
     parent::boot($router);
 }
开发者ID:shempignon,项目名称:laravel-5-blog-mvc,代码行数:20,代码来源:RouteServiceProvider.php

示例10: ensure_unique_name

function ensure_unique_name($name)
{
    // $addition = substr(uniqid(),0,3); //uniqid USES LETTERS AND NUMBERS
    $selection = '0123456789';
    $addition = substr(str_shuffle($selection), 0, 3);
    if (User::whereName($name)->count() > 0) {
        return $name . '_' . $addition;
    } else {
        return $name;
    }
}
开发者ID:halayuba,项目名称:laravel5-tickets,代码行数:11,代码来源:helpers.php

示例11: run

 /**
  * Run the database seeds.
  *
  * @return void
  */
 public function run()
 {
     // Rodri
     $userId = User::whereName('Rodri')->first()->id;
     DB::table('product_user')->insert(['user_id' => $userId, 'product_code' => 14525]);
 }
开发者ID:Aphix-Labs,项目名称:bodega-laravel,代码行数:11,代码来源:UserProductSeeder.php

示例12: apiUserDetails

 /**
  * API for retrieving details of a single user
  */
 public function apiUserDetails(User $user)
 {
     return $userWithRoles = User::whereName($user->name)->with('roles')->first();
 }
开发者ID:goatatwork,项目名称:goatshark,代码行数:7,代码来源:UsersController.php

示例13: getUser

 public function getUser()
 {
     return User::whereName('sam')->first();
 }
开发者ID:samkitano,项目名称:laravel-user-activation,代码行数:4,代码来源:UserActivationTest.php

示例14: findUser

 public function findUser($name)
 {
     return User::whereName($name)->first();
 }
开发者ID:mathewsandi,项目名称:Sezgi,代码行数:4,代码来源:DbUserRepository.php

示例15: updatePoints

 public function updatePoints()
 {
     if (Request::ajax()) {
         $user = User::whereName(Input::get('user'))->first();
         $points = Input::get('points');
         if ($user === null) {
             return "DENIED";
         } elseif ($points === null) {
             return "DENIED";
         } else {
             $user->points += $points;
             $user->save();
             return "OK";
         }
     }
 }
开发者ID:mathewsandi,项目名称:Sezgi,代码行数:16,代码来源:AdminController.php


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