mirror of
https://gitlab.com/CIEFWorldwideSdnBhd/shipping-portal.git
synced 2026-08-19 04:24:12 +00:00
65 lines
1.3 KiB
PHP
65 lines
1.3 KiB
PHP
<?php
|
|
|
|
namespace App\Models;
|
|
|
|
use Carbon\Traits\Timestamp;
|
|
use Illuminate\Database\Eloquent\Relations\HasOne;
|
|
use Illuminate\Database\Eloquent\Relations\MorphTo;
|
|
use Illuminate\Database\Eloquent\SoftDeletes;
|
|
|
|
use Illuminate\Database\Eloquent\Relations\hasMany;
|
|
|
|
/**
|
|
* Class Document
|
|
* @package App\Models
|
|
* @version August 4, 2020, 4:36 am
|
|
*
|
|
* @property int $owner_id
|
|
* @property string $owner_type
|
|
* @property string $document_type
|
|
* @property string $reference
|
|
* @property int $status
|
|
* @property int $approver
|
|
* @property \Carbon\Carbon $issued_date
|
|
* @property \Carbon\Carbon $expired_date
|
|
* @property \Carbon\Carbon $approval_date
|
|
*/
|
|
class Document extends AbstractModel
|
|
{
|
|
use SoftDeletes;
|
|
|
|
protected $table = 'documents';
|
|
|
|
protected function casts(): array
|
|
{
|
|
return [
|
|
'deleted_at' => 'datetime',
|
|
];
|
|
}
|
|
|
|
/**
|
|
* @return \Illuminate\Database\Eloquent\Relations\MorphTo
|
|
*/
|
|
public function owner(): morphTo
|
|
{
|
|
return $this->morphTo();
|
|
}
|
|
|
|
/**
|
|
* @return hasMany
|
|
*/
|
|
public function files(): hasMany
|
|
{
|
|
return $this->hasMany(File::class, 'document_id');
|
|
}
|
|
|
|
/**
|
|
* @return HasOne
|
|
*/
|
|
public function approver(): hasOne
|
|
{
|
|
return $this->hasOne(User::class, 'id', 'approver');
|
|
}
|
|
|
|
}
|