From 8eebdcd093e07bc35f5f17dc59b3c53da9704d83 Mon Sep 17 00:00:00 2001 From: Zain Fauzan Rofie Azizi Date: Mon, 2 Jul 2018 15:24:32 +0800 Subject: [PATCH] added company, warehouse, contact seeder --- app/Company.php | 19 ++++++++++++++++++- app/DeliveryInfo.php | 12 ++++++------ app/Warehouse.php | 20 +++++++++++++++++++- database/seeds/CompanySeeder.php | 6 ++++-- database/seeds/ContactSeeder.php | 12 +++++++++++- database/seeds/DatabaseSeeder.php | 4 +++- database/seeds/DeliveryInfoSeeder.php | 14 +++++++------- database/seeds/WarehouseSeeder.php | 18 +++++++++++++++++- 8 files changed, 85 insertions(+), 20 deletions(-) diff --git a/app/Company.php b/app/Company.php index 99937c0..3ec8433 100644 --- a/app/Company.php +++ b/app/Company.php @@ -7,8 +7,25 @@ use Illuminate\Database\Eloquent\Model; class Company extends Model { - protected $fillable = ['user_id', 'company_profile', 'reg_cert', 'company_name', 'registration_no', 'tax_no', 'tel_no', 'fax', 'address', 'city', 'postcode', 'state', 'country', 'contact_person']; + protected $fillable = [ + + 'company_profile', + 'reg_cert', + 'company_name', + 'registration_no', + 'tax_no', + 'tel_no', + 'fax', + 'address', + 'city', + 'postcode', + 'state', + 'country', + 'contact_person', + 'user_id', + ]; + public function user() { return $this->belongsTo('App\User'); diff --git a/app/DeliveryInfo.php b/app/DeliveryInfo.php index 8aeacae..b5ef49c 100644 --- a/app/DeliveryInfo.php +++ b/app/DeliveryInfo.php @@ -6,8 +6,8 @@ use Illuminate\Database\Eloquent\Model; class Deliveryinfo extends Model { - protected $fillable = [ - 'id', + protected $fillable = [ + 'branch', 'deli_info', 'address', @@ -20,10 +20,10 @@ class Deliveryinfo extends Model 'com_id' ]; - public function company() { + public function company(){ - return $this->belongsTo('App\Company'); - - } + return $this->belongsTo(App/Company); + + } } diff --git a/app/Warehouse.php b/app/Warehouse.php index a85af99..0609d99 100644 --- a/app/Warehouse.php +++ b/app/Warehouse.php @@ -6,6 +6,24 @@ use Illuminate\Database\Eloquent\Model; class Warehouse extends Model { - protected $fillable = ['city', 'address','zip','state','contact_person','contact_person_no','branch','country','com_id']; + protected $fillable = [ + + 'address', + 'city', + 'zip', + 'state', + 'contact_person', + 'contact_person_no', + 'branch', + 'country', + 'com_id' + + ]; + + public function company(){ + + return $this->belongsTo(App/Company); + + } } diff --git a/database/seeds/CompanySeeder.php b/database/seeds/CompanySeeder.php index b35e062..c4f6c9b 100644 --- a/database/seeds/CompanySeeder.php +++ b/database/seeds/CompanySeeder.php @@ -15,9 +15,11 @@ class CompanySeeder extends Seeder DB::table('companies')->insert([ 'id' => '999', + 'company_profile'=>'testing', + 'reg_cert'=>'12345', 'company_name'=>'testing', - 'registration_no'=>'testing', - 'tax_no'=>'testing', + 'registration_no'=>'12345', + 'tax_no'=>'12345', 'tel_no'=>'12345', 'fax'=>'12345', 'address'=>'testing', diff --git a/database/seeds/ContactSeeder.php b/database/seeds/ContactSeeder.php index f6bfc4a..98e6293 100644 --- a/database/seeds/ContactSeeder.php +++ b/database/seeds/ContactSeeder.php @@ -1,6 +1,7 @@ insert([ + + 'id' => '999', + 'user_id' => '2', + 'com_id' => '999', + 'status' => '1', + 'created_at' => Carbon::now()->format('Y-m-d H:i:s'), + 'updated_at' => Carbon::now()->format('Y-m-d H:i:s'), + + ]); } } diff --git a/database/seeds/DatabaseSeeder.php b/database/seeds/DatabaseSeeder.php index 109c2bc..df697fa 100644 --- a/database/seeds/DatabaseSeeder.php +++ b/database/seeds/DatabaseSeeder.php @@ -13,7 +13,9 @@ class DatabaseSeeder extends Seeder { $this->call(LaratrustSeeder::class); $this->call(UsersTableSeeder::class); - $this->call(DeliveryInfoSeeder::class); $this->call(CompanySeeder::class); + $this->call(DeliveryInfoSeeder::class); + $this->call(WarehouseSeeder::class); + $this->call(ContactSeeder::class); } } diff --git a/database/seeds/DeliveryInfoSeeder.php b/database/seeds/DeliveryInfoSeeder.php index 88638fb..d8f8448 100644 --- a/database/seeds/DeliveryInfoSeeder.php +++ b/database/seeds/DeliveryInfoSeeder.php @@ -15,14 +15,14 @@ class DeliveryInfoSeeder extends Seeder DB::table('deliveryinfos')->insert([ 'id' => '999', - 'branch' => 'Testing', - 'deli_info' => 'Testing', - 'address' => 'Testing', - 'city' => 'Test', + 'branch' => 'testing', + 'deli_info' => 'testing', + 'address' => 'testing', + 'city' => 'testing', 'postcode' => '12345', - 'state' => 'Testing', - 'country' => 'Testing', - 'contact_person' => 'Testing', + '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'), diff --git a/database/seeds/WarehouseSeeder.php b/database/seeds/WarehouseSeeder.php index 49cade1..a2a5f92 100644 --- a/database/seeds/WarehouseSeeder.php +++ b/database/seeds/WarehouseSeeder.php @@ -1,6 +1,7 @@ insert([ + + 'id' => '999', + 'address'=>'testing', + 'city'=>'testing', + 'zip'=>'12345', + 'state'=>'testing', + 'contact_person'=>'testing', + 'contact_person_no'=>'12345', + 'branch'=>'testing', + 'country'=>'testing', + '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' + + ]); } }