當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。