From 6317736643ca26c6d9ed1f9e9a50449c40baa3ab Mon Sep 17 00:00:00 2001 From: Omair Saleh Date: Sat, 5 Oct 2019 14:30:00 +0800 Subject: [PATCH] large commit --- app/Http/Resources/Company.php | 2 +- app/Models/Company.php | 2 +- database/seeds/DatabaseSeeder.php | 11 ----------- 3 files changed, 2 insertions(+), 13 deletions(-) diff --git a/app/Http/Resources/Company.php b/app/Http/Resources/Company.php index 1137b47..0c56bf3 100644 --- a/app/Http/Resources/Company.php +++ b/app/Http/Resources/Company.php @@ -19,7 +19,7 @@ class Company extends JsonResource */ public function toArray($request) { - $billing = $this->addressBook()->where('reference_id', $this->id)->where('type', 0) + $billing = $this->addressBook()->where('reference_id', $this->id)->where('type', 1) ->where('billing', true)->first(); $reports = \App\Models\Order::select(DB::raw('count(*) total'), DB::raw('SUM(CASE WHEN complete = 0 THEN 0 ELSE 1 END) active'))->where('company_id', $this->id)->first(); return [ diff --git a/app/Models/Company.php b/app/Models/Company.php index 07dd567..b11d86b 100644 --- a/app/Models/Company.php +++ b/app/Models/Company.php @@ -13,7 +13,7 @@ class Company extends AbstractModel public function addressBook() { - return $this->hasMany('App\Models\AddressBook', 'reference_id', 'id')->where('type', '=', 0); + return $this->hasMany('App\Models\AddressBook', 'reference_id', 'id')->where('type', '=', 1); } } diff --git a/database/seeds/DatabaseSeeder.php b/database/seeds/DatabaseSeeder.php index 4c5e982..b494f7a 100644 --- a/database/seeds/DatabaseSeeder.php +++ b/database/seeds/DatabaseSeeder.php @@ -13,16 +13,5 @@ class DatabaseSeeder extends Seeder $this->call(CompaniesTableSeeder::class); $this->call(ContactsTableSeeder::class); $this->call(WarehousesTableSeeder::class); - if(app()->environment() !== "production"){ - -// $this->call(AddressBookTableSeeder::class); - -// $this->call(OrdersTableSeeder::class); -// $this->call(PackingListsTableSeeder::class); -// $this->call(PackagesTableSeeder::class); - } - -// $this->call(PrimaryStepsTableSeeder::class); -// $this->call(ModularStepsTableSeeder::class); } }