large commit

This commit is contained in:
Omair Saleh
2019-10-05 13:09:26 +08:00
parent a20feebe0c
commit 0e5f2939e3
94 changed files with 1131 additions and 540 deletions
+12 -2
View File
@@ -7,11 +7,21 @@ class AddressBook extends AbstractModel
protected $table = 'address_book';
protected $fillable = [
'company_id', 'reference', 'contact', 'street_one', 'street_two', 'city', 'state', 'post_code', 'country', 'default', 'billing'
'type', 'reference_id', 'reference', 'contact', 'street_one', 'street_two', 'city', 'state', 'post_code', 'country', 'default', 'billing'
];
public function forwarder()
{
return $this->belongsTo('App\Models\Forwarder', 'id', 'reference_id')->where('type', '=', 0);
}
public function company()
{
return $this->belongsTo('App\Models\Company');
return $this->belongsTo('App\Models\Company', 'id', 'reference_id')->where('type', '=', 1);
}
public function warehouse()
{
return $this->belongsTo('App\Models\Warehouse', 'id', 'reference_id')->where('type', '=', 2);
}
}