mirror of
https://gitlab.com/CIEFWorldwideSdnBhd/portal.git
synced 2026-08-19 12:34:01 +00:00
61 lines
1.2 KiB
PHP
61 lines
1.2 KiB
PHP
<?php
|
|
|
|
namespace App\Models;
|
|
|
|
use Illuminate\Database\Eloquent\Relations\BelongsTo;
|
|
use Illuminate\Database\Eloquent\Relations\BelongsToMany;
|
|
use Illuminate\Database\Eloquent\Relations\HasManyThrough;
|
|
use Illuminate\Database\Eloquent\SoftDeletes;
|
|
|
|
|
|
/**
|
|
* Class Address
|
|
* @package App\Models
|
|
* @version August 4, 2020, 4:36 am
|
|
*
|
|
* @property \App\Models\Company company
|
|
* @property string street_one
|
|
* @property string street_two
|
|
* @property string city
|
|
* @property string state
|
|
* @property string post_code
|
|
* @property string country
|
|
*/
|
|
class Order extends AbstractModel
|
|
{
|
|
|
|
use SoftDeletes;
|
|
|
|
protected $table = 'orders';
|
|
|
|
protected $dates = ['deleted_at'];
|
|
|
|
/**
|
|
* @return belongsToMany
|
|
*/
|
|
public function warehouses(): belongsToMany
|
|
{
|
|
return $this->belongsToMany(Company::class, (new OrderWarehouse())->getTable(), 'warehouse_id','order_id');
|
|
}
|
|
|
|
/**
|
|
* @return belongsTo
|
|
*/
|
|
public function importer(): belongsTo
|
|
{
|
|
return $this->belongsTo(Company::class, 'company_id','id');
|
|
}
|
|
|
|
/**
|
|
* @return belongsTo
|
|
*/
|
|
public function address(): belongsTo
|
|
{
|
|
return $this->belongsTo(Address::class, 'address_id','id');
|
|
}
|
|
|
|
|
|
|
|
|
|
}
|