コード例 #1
0
 /**
  * Run the database seeds.
  *
  * @return void
  */
 public function run()
 {
     $bills = array(array('name' => 'Rent', 'amount' => 500, 'frequency' => 4), array('name' => 'Insurance', 'amount' => 200, 'frequency' => 4), array('name' => 'Gas', 'amount' => 100, 'frequency' => 4), array('name' => 'Groceries', 'amount' => 100, 'frequency' => 1), array('name' => 'Spotify', 'amount' => 500, 'frequency' => 4), array('name' => 'Netflix', 'amount' => 500, 'frequency' => 4), array('name' => 'Hydro', 'amount' => 75, 'frequency' => 4));
     $user = App\User::first();
     foreach ($bills as $bill) {
         $user->bills()->create($bill);
     }
 }
コード例 #2
0
 /**
  * @disabled_test
  * Testing auth/refresh-token appears to not be possible with
  * unit tests and should be tested with behavior tests.
  */
 public function it_authenticates_with_a_token_and_refreshes_the_token()
 {
     //arrange
     $this->make('App\\User', ['email' => $this->getStub()['email'], 'password' => Hash::make($this->getStub()['password'])]);
     //act
     $new_token = $this->getJson('authenticate/refresh-token', 'POST', [], [], [], $this->headers(App\User::first()));
     //assert
     $this->assertResponseOk();
     $this->assertObjectHasAttributes($new_token, 'token');
     $this->assertTrue($new_token->token);
     $this->assertTrue($token != $new_token->token);
 }
コード例 #3
0
 public function run()
 {
     DB::table('posts')->delete();
     $faker = Faker::create();
     foreach (range(1, 100) as $index) {
         $user = App\User::first();
         if ($index % 2 == 0) {
             $user = App\User::orderBy('created_at', 'desc')->first();
         }
         Post::create(['title' => $index . ': ' . $faker->sentence, 'body' => $faker->paragraph, 'user_id' => $user->id]);
     }
 }
 public function testReservationRoomExample()
 {
     $reservationRepo = new ReservationRepository(new ReservationStore());
     $start_date = '2015-10-01';
     $end_date = '2015-10-10';
     $user_id = App\User::first()->id;
     $rooms = Room::take(2)->lists('id')->toArray();
     $reservation = $reservationRepo->create(['date_start' => $start_date, 'date_end' => $end_date, 'rooms' => $rooms, 'reservation_number' => '0001', 'user_id' => $user_id]);
     $this->assertInstanceOf('App\\Reservation', $reservation);
     $this->assertEquals('2015-10-01', $reservation->date_start);
     $this->assertEquals(2, count($reservation->rooms));
 }
コード例 #5
0
 /**
  * Run the database seeds.
  *
  * @return void
  */
 public function run()
 {
     App\User::first()->income()->create(['name' => 'Salary', 'amount' => 50000, 'frequency' => 7]);
 }
コード例 #6
0
 /**
  * A basic test example.
  *
  * @return void
  */
 public function testAddClientOk()
 {
     $user = App\User::first();
     $client = App\Client::all()->last();
     $this->actingAs($user)->withSession(['foo' => 'bar'])->visit('/')->click('Clients')->see('List of clients')->click('Add client')->type('Gica', 'Name')->type('Bradford, Laisteridge Lane, Revis Barber Halls, BD71LD', 'Address')->type('07511376542', 'PhoneNo')->type('*****@*****.**', 'Email')->press('Add client')->seeInDatabase('clients', ['Id' => $client->Id + 1]);
 }
コード例 #7
0
 /**
  * Run the database seeds.
  *
  * @return void
  */
 public function run()
 {
     $user = App\User::first();
     //$user->alternatives()->attach(2, ['flag_id' => 1]);
     // $user->alternatives()->attach(3, ['flag_id' => 2, 'ignore' => true]);
 }
コード例 #8
0
<?php

Route::get('/', function () {
    $user = App\User::first();
    return view('child', compact('user'));
});
コード例 #9
0
ファイル: ModelFactory.php プロジェクト: buys-fran/mtech-mis
$factory->define(App\Models\Tds::class, function (Faker\Generator $faker) {
    $user_id = App\User::first() ? App\User::first()->id : factory(App\User::class)->create()->id;
    Auth::user() ?: Auth::login(App\User::find($user_id));
    return ['tds_jc_id_fk' => factory(App\Models\JobCosting::class)->create()->job_costing_id, 'tds_supplier_id_fk' => App\Models\Supplier::first()->supplier_id ?: factory(App\Models\Supplier::class)->create()->supplier_id, 'tds_barcode' => $faker->randomNumber(9), 'tds_pressmarks' => 'Standard', 'tds_invoice' => 1, 'tds_pop_or_po' => 1, 'tds_printed_side' => 'Reverse', 'tds_cyl_drawing' => 'Existing', 'tds_note' => $faker->paragraph, 'tds_added_user_id_fk' => $user_id, 'tds_modified_user_id_fk' => $user_id, 'tds_date_added' => \Carbon\Carbon::now(), 'tds_date_modified' => \Carbon\Carbon::now()];
});
$factory->define(App\Models\PrintStation::class, function (Faker\Generator $faker) {
    $user_id = App\User::first() ? App\User::first()->id : factory(App\User::class)->create()->id;
    Auth::user() ?: Auth::login(App\User::find($user_id));
    return ['tds_ink_tds_fk_id' => factory(App\Models\Tds::class)->create()->tds_id, 'tds_ink_ink_fk_id' => factory(App\Models\Ink::class)->create()->ink_id, 'tds_ink_cylinder_fk_id' => factory(App\Models\Cylinder::class)->create()->cylinders_id, 'tds_ink_link_temperature' => $faker->randomNumber(2), 'tds_ink_link_viscosity' => 18, 'tds_ink_link_sequence' => $faker->numberBetween(1, 8), 'tds_ink_link_added_user_fk' => $user_id, 'tds_ink_link_mod_user_fk' => $user_id, 'tds_ink_link_added_date' => \Carbon\Carbon::now(), 'tds_ink_link_mod_date' => \Carbon\Carbon::now()];
});
$factory->define(App\Models\Cylinder::class, function (Faker\Generator $faker) {
    $user_id = App\User::first() ? App\User::first()->id : factory(App\User::class)->create()->id;
    Auth::user() ?: Auth::login(App\User::find($user_id));
    return ['cylinders_item_number' => $faker->randomNumber(5), 'cylinders_location' => $faker->word, 'cylinders_location_code' => $faker->randomNumber(5), 'cylinders_coverage' => $faker->numberBetween(50, 100), 'cylinders_added_user_id_fk' => $user_id, 'cylinders_modified_user_id_fk' => $user_id, 'cylinders_date_added' => \Carbon\Carbon::now(), 'cylinders_date_modified' => \Carbon\Carbon::now(), 'cylinders_is_deleted' => 0];
});
$factory->define(App\Models\DespatchLogEntry::class, function (Faker\Generator $faker) {
    $user_id = App\User::first() ? App\User::first()->id : factory(App\User::class)->create()->id;
    Auth::user() ?: Auth::login(App\User::find($user_id));
    $job = factory(App\Models\JobCard::class)->create();
    return ['despatch_log_book_job_cards_id_fk' => $job->job_cards_id, 'despatch_log_book_invoice_id_fk' => null, 'despatch_log_book_unit' => 'Kg', 'despatch_log_book_total' => $faker->randomNumber(3), 'despatch_log_book_pallet_kg' => $faker->randomNumber(1), 'despatch_log_book_no_reels' => $faker->randomNumber(2), 'despatch_log_book_invoiced' => 0, 'despatch_log_book_tran_type' => $faker->randomElement(['RETURN', 'DESPATCH']), 'selling_price' => $faker->randomFloat(2, 10, 200), 'created_by' => $user_id, 'updated_by' => $user_id];
});
$factory->define(App\Models\WasteRegisterEntry::class, function (Faker\Generator $faker) {
    $user_id = App\User::first() ? App\User::first()->id : factory(App\User::class)->create()->id;
    Auth::user() ?: Auth::login(App\User::find($user_id));
    return ['job_cards_id' => factory(App\Models\JobCard::class)->create()->job_cards_id, 'waste_codes_id' => factory(App\Models\WasteCode::class)->create()->id, 'operator_id' => factory(App\User::class)->create()->id, 'weight_kg' => $faker->randomNumber(2)];
});
$factory->define(App\Models\WasteCode::class, function (Faker\Generator $faker) {
    $user_id = App\User::first() ? App\User::first()->id : factory(App\User::class)->create()->id;
    Auth::user() ?: Auth::login(App\User::find($user_id));
    return ['department_id' => factory(App\Models\Department::class)->create()->id, 'description' => $faker->words(3, true)];
});
コード例 #10
0
 /**
  * Run the database seeds.
  *
  * @return void
  */
 public function run()
 {
     App\User::first()->debts()->create(['accountName' => 'RBC CREDIT LINE', 'accountHolder' => 'TRISTAN GEMUS', 'runningBalance' => '17429.41', 'type' => 3]);
 }
コード例 #11
0
 /**
  * A basic functional test example.
  *
  * @return void
  */
 public function testAddCarOk()
 {
     $user = App\User::first();
     $this->actingAs($user)->withSession(['foo' => 'bar'])->visit('/')->click('Cars')->see('List of cars')->click('Add car')->type('DB05RON', 'LicencePlate')->select(App\Client::first()->Id, 'ClientId')->type('', 'Model')->press('Add car')->seeInDatabase('cars', ['LicencePlate' => 'DB05RON']);
 }