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


PHP User::first方法代码示例

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


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

示例1: testTheAppView

 public function testTheAppView()
 {
     $this->artisan('db:seed');
     $this->be(User::first());
     $this->visit('/')->see('MyGains');
     $this->assertViewHas(["exercises", "workouts"]);
 }
开发者ID:Carlsson87,项目名称:lumen,代码行数:7,代码来源:HomeControllerTest.php

示例2: register

 /**
  * Register any application services.
  *
  * @return void
  */
 public function register()
 {
     $this->app->singleton('App\\Settings', function () {
         return User::first()->settings();
         //            return \Auth::user()->settings();
     });
 }
开发者ID:viethung09,项目名称:kidblog,代码行数:12,代码来源:AppServiceProvider.php

示例3: testFactory

 public function testFactory()
 {
     factory(User::class, 50)->create();
     $user = User::first();
     $this->assertInstanceOf(User::class, $user);
     $this->assertTrue($user->exists());
 }
开发者ID:mattvb91,项目名称:website-laravel,代码行数:7,代码来源:UserTest.php

示例4: test

 public function test($id)
 {
     $user = \App\Models\User::findHashed('47ee991c-8500-42e7-b6ba-50f6c1edb729');
     $user->load('roles');
     return $user;
     return route('test', \App\Models\User::first());
     return $id;
 }
开发者ID:nich-mctishe,项目名称:laravel-framework,代码行数:8,代码来源:WelcomeController.php

示例5: testDisplayCreateForm

 public function testDisplayCreateForm()
 {
     echo "\n\nINSTRUMENT CONTROLLER TEST\n\n";
     $url = URL::route('instrument.create');
     // Set the current user to admin
     $this->be(User::first());
     $this->visit($url)->see('name');
 }
开发者ID:echiteri,项目名称:iBLIS,代码行数:8,代码来源:InstrumentControllerTest.php

示例6: testDelete

 /**
  * Testing Lot destroy funciton
  */
 public function testDelete()
 {
     $this->be(User::first());
     $this->runStore($this->input);
     $lot = new LotController();
     $lot->delete(1);
     $lotDeleted = Lot::withTrashed()->find(1);
     $this->assertNotNull($lotDeleted->deleted_at);
 }
开发者ID:echiteri,项目名称:iBLIS,代码行数:12,代码来源:LotControllerTest.php

示例7: testDelete

 /**
  * Tests the update function in the SupplierController
  * @depends testStore
  * @param void
  * @return void
  */
 public function testDelete()
 {
     $this->be(User::first());
     $this->runStore($this->input);
     $supplier = new SupplierController();
     $supplier->delete(1);
     $supplierDeleted = Supplier::withTrashed()->find(1);
     $this->assertNotNull($supplierDeleted->deleted_at);
 }
开发者ID:echiteri,项目名称:iBLIS,代码行数:15,代码来源:SupplierControllerTest.php

示例8: seedAcl

 private function seedAcl()
 {
     Bouncer::seeder(function () {
         Bouncer::allow('admin')->to(['system.view', 'users.view', 'system.manage', 'users.manage']);
         Bouncer::allow('manager')->to(['system.view', 'system.manage']);
         Bouncer::allow('user')->to(['system.view']);
         Bouncer::assign('admin')->to(User::first());
         Bouncer::assign('manager')->to(User::where(['login' => 'manager'])->first());
     });
 }
开发者ID:exfriend,项目名称:larabox,代码行数:10,代码来源:AppServiceProvider.php

示例9: testDelete

 /**
  * Tests the update function in the PatientController
  * @depends testStore
  * @param void
  * @return void
  */
 public function testDelete()
 {
     $this->be(User::first());
     $this->runStore($this->input);
     $patientSaved = Patient::orderBy('id', 'desc')->first();
     $patient = new PatientController();
     $patient->delete($patientSaved->id);
     $patientsDeleted = Patient::withTrashed()->find($patientSaved->id);
     $this->assertNotNull($patientsDeleted->deleted_at);
 }
开发者ID:echiteri,项目名称:iBLIS,代码行数:16,代码来源:PatientControllerTest.php

示例10: testStore

 /**
  * Tests the store function in the ChargeController
  * @param  void
  * @return int $testChargeId ID of Charge stored;used in testUpdate() to identify test for update
  */
 public function testStore()
 {
     echo "\n\nCHARGE CONTROLLER TEST\n\n";
     // Store the Charge
     $this->withoutMiddleware();
     $this->be(User::first());
     $this->call('POST', '/charge', $this->chargeData);
     $chargeStored = Charge::orderBy('id', 'desc')->first();
     $this->assertEquals($this->chargeData['test_id'], $chargeStored->test_id);
     $this->assertEquals($this->chargeData['current_amount'], $chargeStored->current_amount);
 }
开发者ID:echiteri,项目名称:iBLIS,代码行数:16,代码来源:ChargeControllerTest.php

示例11: test_passwords_delete

 public function test_passwords_delete()
 {
     $this->test_access_after_setup();
     $user = User::first();
     $folder = PasswordFolder::where('user_id', $user->id)->first();
     $password = factory(Password::class)->create(['folder_id' => $folder->id]);
     $this->actingAs($password->folder->user);
     $token = ['_token' => \Session::token()];
     $this->delete(route('passwords.destroy', [$password->id]), $token);
     $this->assertRedirectedToRoute('passwords.index');
 }
开发者ID:stevebauman,项目名称:ithub,代码行数:11,代码来源:PasswordFolderTest.php

示例12: testStore

 /**
  * Tests the store function in the PaymentController
  * @param  void
  * @return int $testPaymentId ID of Payment stored;used in testUpdate() to identify test for update
  */
 public function testStore()
 {
     echo "\n\nPAYMENT CONTROLLER TEST\n\n";
     // Store the Payment
     $this->withoutMiddleware();
     $this->be(User::first());
     $this->call('POST', '/payment', $this->paymentData);
     $paymentStored = Payment::orderBy('id', 'desc')->first();
     $this->assertEquals($this->paymentData['patient_id'], $paymentStored->patient_id);
     $this->assertEquals($this->paymentData['charge_id'], $paymentStored->charge_id);
     $this->assertEquals($this->paymentData['full_amount'], $paymentStored->full_amount);
     $this->assertEquals($this->paymentData['amount_paid'], $paymentStored->amount_paid);
 }
开发者ID:echiteri,项目名称:iBLIS,代码行数:18,代码来源:PaymentControllerTest.php

示例13: testStore

 /**
  * Tests the store function in the DrugController
  * @param  void
  * @return int $testDrugId ID of Drug stored;used in testUpdate() to identify test for update
  */
 public function testStore()
 {
     echo "\n\nDRUG CONTROLLER TEST\n\n";
     // Store the Drug
     $this->withoutMiddleware();
     $this->be(User::first());
     $response = $this->call('POST', '/drug', $this->drugData);
     // dd($response);
     $drugStored = Drug::orderBy('id', 'desc')->take(1)->get()->first();
     // dd($drugStored);
     // $drugSaved = Drug::find($drugStored->id);
     $this->assertEquals($this->drugData['name'], $drugStored->name);
     $this->assertEquals($this->drugData['description'], $drugStored->description);
 }
开发者ID:echiteri,项目名称:iBLIS,代码行数:19,代码来源:DrugControllerTest.php

示例14: form

 public function form($form)
 {
     $class = 'app\\forms\\' . $form;
     $form = new $class($this, array('user' => models\User::first('1 ORDER BY RAND()'), 'domain' => models\Domain::first('1 ORDER BY RAND()')));
     $content = '';
     if ($this->POST) {
         $content .= '<pre>VALIDATION: ' . ($form->validate($_POST) ? 'OK' : 'FAIL') . '</pre>';
         $content .= '<pre>' . print_r($form->errors(), 1) . '</pre>';
     }
     $content .= $form->render();
     $content .= '<pre>$_POST: ' . print_r($_POST, 1) . '</pre>';
     $content .= '<pre>&output: ' . print_r($form->output, 1) . '</pre>';
     $content .= '<pre>$form: ' . print_r($form, 1) . '</pre>';
     return $this->tpl->display(false, array('content' => $content));
 }
开发者ID:rudiedirkx,项目名称:Rudie-on-wheels,代码行数:15,代码来源:homeController.php

示例15: testProfileSendEmail

 /**
  * Checks that the message box sends an email
  *
  * (I believe Laravel has a feature for this, so an email is not actually sent)
  */
 public function testProfileSendEmail()
 {
     $faker = Faker\Factory::create();
     factory(App\Models\Profile::class, 'withAUser', 1)->create();
     $user = App\Models\User::first();
     $message = $faker->sentences(3);
     $this->visit(route('profile.view', ['name' => $user->username]))->type($message, 'message')->submitForm('Send');
     $mock = \Mockery::mock($this->app['mailer']->getSwiftMailer());
     $this->app['mailer']->setSwiftMailer($mock);
     $mock->shouldReceive('send')->withArgs([\Mockery::on(function ($message) {
         $this->assertEquals(trans('profile.message_subject', ['from' => Auth::user()->username]), $message->getSubject());
         $this->assertSame([$user->profile->email => null], $message->getTo());
         $this->assertContains(trans('profile.message_body'), $message->getBody());
         return true;
     }), \Mockery::any()])->once();
 }
开发者ID:khoparzi,项目名称:PairUp,代码行数:21,代码来源:ProfileViewTest.php


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