From 644339a224c32d193166a3f5d558d798e20427e5 Mon Sep 17 00:00:00 2001 From: weichien00 Date: Thu, 8 Jul 2021 01:10:49 +0800 Subject: [PATCH] add: copy serviceType models file from exchange2.0. --- app/Models/ServiceType.php | 70 ++++++++++++++++++++++++++++++++++++++ 1 file changed, 70 insertions(+) create mode 100644 app/Models/ServiceType.php diff --git a/app/Models/ServiceType.php b/app/Models/ServiceType.php new file mode 100644 index 00000000..ecc4750e --- /dev/null +++ b/app/Models/ServiceType.php @@ -0,0 +1,70 @@ + '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]); + } +}