large commit

This commit is contained in:
Omair Saleh
2019-10-05 14:30:00 +08:00
parent 1aac91e5e2
commit 6317736643
3 changed files with 2 additions and 13 deletions
+1 -1
View File
@@ -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 [
+1 -1
View File
@@ -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);
}
}
-11
View File
@@ -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);
}
}