58 lines
1.2 KiB
PHP
58 lines
1.2 KiB
PHP
<?php
|
|
|
|
namespace App\Models\Companies;
|
|
|
|
use App\Support\RelationValuesTrait;
|
|
use App\Support\UuidScopeTrait;
|
|
use Illuminate\Database\Eloquent\Model;
|
|
use Illuminate\Database\Eloquent\Relations\BelongsTo;
|
|
use Illuminate\Database\Eloquent\SoftDeletes;
|
|
|
|
class Address extends Model {
|
|
use UuidScopeTrait, SoftDeletes, RelationValuesTrait;
|
|
|
|
protected $table = 'company_addresses';
|
|
|
|
protected $dates = [
|
|
'deleted_at',
|
|
];
|
|
|
|
protected $fillable = [
|
|
'uuid',
|
|
'company_id',
|
|
'type',
|
|
'full',
|
|
'postcode',
|
|
'country',
|
|
'region',
|
|
'city',
|
|
'district',
|
|
'street',
|
|
'house',
|
|
'block',
|
|
'office'
|
|
];
|
|
|
|
protected $hidden = [
|
|
|
|
];
|
|
|
|
public static string $TYPE_LEGAL = 'legal';
|
|
public static string $TYPE_ACTUAL = 'actual';
|
|
|
|
|
|
|
|
public function company(): BelongsTo {
|
|
return $this->belongsTo(Company::class);
|
|
}
|
|
|
|
|
|
|
|
public function setFullAddress($val) {
|
|
$address = ['full' => $val, 'postcode' => '', 'country' => '', 'region' => '', 'city' => '',
|
|
'district' => '', 'street' => '', 'house' => '', 'block' => '', 'office' => ''];
|
|
$this->update($address);
|
|
}
|
|
|
|
}
|