mirror of
https://gitlab.com/CIEFWorldwideSdnBhd/portal.git
synced 2026-08-19 04:23:59 +00:00
Initial commit
This commit is contained in:
@@ -0,0 +1,85 @@
|
||||
<?php
|
||||
|
||||
namespace App\Models;
|
||||
|
||||
use App\Models\AbstractModel as Model;
|
||||
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 Address extends AbstractModel
|
||||
{
|
||||
|
||||
use SoftDeletes;
|
||||
|
||||
|
||||
protected $table = 'addresses';
|
||||
|
||||
|
||||
|
||||
protected $dates = ['deleted_at'];
|
||||
|
||||
|
||||
|
||||
public $fillable = [
|
||||
'street_one',
|
||||
'street_two',
|
||||
'city',
|
||||
'state',
|
||||
'post_code',
|
||||
'country'
|
||||
];
|
||||
|
||||
/**
|
||||
* The attributes that should be casted to native types.
|
||||
*
|
||||
* @var array
|
||||
*/
|
||||
protected $casts = [
|
||||
'street_one' => 'string',
|
||||
'street_two' => 'string',
|
||||
'city' => 'string',
|
||||
'state' => 'string',
|
||||
'post_code' => 'string',
|
||||
'country' => 'string',
|
||||
'default' => 'integer',
|
||||
'billing' => 'integer'
|
||||
];
|
||||
|
||||
/**
|
||||
* Validation rules
|
||||
*
|
||||
* @var array
|
||||
*/
|
||||
public static $rules = [
|
||||
'company_id' => 'required',
|
||||
'street_one' => 'required',
|
||||
'city' => 'required',
|
||||
'state' => 'required',
|
||||
'post_code' => 'required',
|
||||
'country' => 'required',
|
||||
'default' => 'required',
|
||||
'billing' => 'required'
|
||||
];
|
||||
|
||||
/**
|
||||
* @return \Illuminate\Database\Eloquent\Relations\HasOne
|
||||
**/
|
||||
public function company(): HasOne
|
||||
{
|
||||
return $this->hasOne(\App\Models\Company::class, 'company_id', 'id');
|
||||
}
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user