mirror of
https://gitlab.com/CIEFWorldwideSdnBhd/shipping-portal.git
synced 2026-08-19 04:24:12 +00:00
add: copy serviceType models file from exchange2.0.
This commit is contained in:
@@ -0,0 +1,70 @@
|
||||
<?php
|
||||
|
||||
namespace App\Models;
|
||||
|
||||
use App\Classes\ValueObjects\Constants\SegmentConstants;
|
||||
use App\Models\AbstractModel as Model;
|
||||
use Illuminate\Database\Eloquent\Relations\HasMany;
|
||||
use Illuminate\Database\Eloquent\SoftDeletes;
|
||||
|
||||
|
||||
/**
|
||||
* Class ServiceType
|
||||
* @package App\Models
|
||||
* @version February 16, 2021, 9:04 pm
|
||||
*
|
||||
* @property string name
|
||||
*/
|
||||
class ServiceType extends AbstractModel
|
||||
{
|
||||
|
||||
use SoftDeletes;
|
||||
|
||||
|
||||
protected $table = 'service_types';
|
||||
|
||||
|
||||
|
||||
protected $dates = ['deleted_at'];
|
||||
|
||||
|
||||
|
||||
public $fillable = [
|
||||
'name'
|
||||
];
|
||||
|
||||
/**
|
||||
* The attributes that should be casted to native types.
|
||||
*
|
||||
* @var array
|
||||
*/
|
||||
protected $casts = [
|
||||
'name' => 'string'
|
||||
];
|
||||
|
||||
/**
|
||||
* Validation rules
|
||||
*
|
||||
* @var array
|
||||
*/
|
||||
public static $rules = [
|
||||
'name' => 'required'
|
||||
];
|
||||
|
||||
/**
|
||||
* @return hasMany
|
||||
*/
|
||||
public function rates(): hasMany
|
||||
{
|
||||
return $this->hasMany(CurrencyRate::class, 'service_id');
|
||||
}
|
||||
|
||||
/**
|
||||
* @return hasMany
|
||||
*/
|
||||
public function constants(): hasMany
|
||||
{
|
||||
return $this->hasMany(SegmentConstant::class, 'detail->id')
|
||||
->whereIn('reference', [SegmentConstants::SERVICE_TYPE, SegmentConstants::CUSTOM_SERVICE_TYPE]);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user