mirror of
https://gitlab.com/uldvstar/exchange-2.0.git
synced 2026-08-19 04:24:16 +00:00
72 lines
1.2 KiB
PHP
72 lines
1.2 KiB
PHP
<?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]);
|
|
}
|
|
|
|
}
|