fix seeding for testing

This commit is contained in:
Zain Fauzan Rofie Azizi
2018-06-12 15:23:17 +08:00
parent 8037733f2e
commit 5fecbf8ade
9 changed files with 76 additions and 32 deletions
@@ -1,18 +0,0 @@
<?php
use Faker\Generator as Faker;
$factory->define(App\Deliveryinfo::class, function (Faker $faker) {
return [
'id' => $faker,
'branch' => $faker->text,
'deli_info' => $faker->sentence,
'address' => $faker->text,
'city' => $faker->text,
'postcode' => $faker->text,
'state' => $faker->text,
'country' => $faker->text,
'contact_person' => $faker->name,
'contact_person_no' => $faker->text,
];
});
+35
View File
@@ -0,0 +1,35 @@
<?php
use Illuminate\Database\Seeder;
use Carbon\Carbon;
class CompanySeeder extends Seeder
{
/**
* Run the database seeds.
*
* @return void
*/
public function run()
{
DB::table('companies')->insert([
'id' => '999',
'company_name'=>'testing',
'registration_no'=>'testing',
'tax_no'=>'testing',
'tel_no'=>'12345',
'fax'=>'12345',
'address'=>'testing',
'city'=>'testing',
'postcode'=>'12345',
'state'=>'testing',
'country'=>'testing',
'contact_person'=>'testing',
'created_at' => Carbon::now()->format('Y-m-d H:i:s'),
'updated_at' => Carbon::now()->format('Y-m-d H:i:s'),
'user_id' => '2'
]);
}
}
+2
View File
@@ -13,5 +13,7 @@ class DatabaseSeeder extends Seeder
{
$this->call(LaratrustSeeder::class);
$this->call(UsersTableSeeder::class);
$this->call(DeliveryInfoSeeder::class);
$this->call(CompanySeeder::class);
}
}
+18 -1
View File
@@ -1,6 +1,7 @@
<?php
use Illuminate\Database\Seeder;
use Carbon\Carbon;
class DeliveryInfoSeeder extends Seeder
{
@@ -11,6 +12,22 @@ class DeliveryInfoSeeder extends Seeder
*/
public function run()
{
//
DB::table('deliveryinfos')->insert([
'id' => '999',
'branch' => 'Testing',
'deli_info' => 'Testing',
'address' => 'Testing',
'city' => 'Test',
'postcode' => '12345',
'state' => 'Testing',
'country' => 'Testing',
'contact_person' => 'Testing',
'contact_person_no' => '12345',
'created_at' => Carbon::now()->format('Y-m-d H:i:s'),
'updated_at' => Carbon::now()->format('Y-m-d H:i:s'),
'com_id' => '999'
]);
}
}