| Server IP : 14.225.204.176 / Your IP : 216.73.216.6 Web Server : nginx/1.24.0 System : Linux nodejs-ybgk 6.8.0-40-generic #40-Ubuntu SMP PREEMPT_DYNAMIC Fri Jul 5 10:34:03 UTC 2024 x86_64 User : root ( 0) PHP Version : 8.1.34 Disable Function : NONE MySQL : OFF | cURL : ON | WGET : ON | Perl : ON | Python : OFF | Sudo : ON | Pkexec : OFF Directory : /var/www/html/php/home-services/app/Models/ |
Upload File : |
<?php
/**
* File name: Discountable.php
* Last modified: 2021.01.03 at 12:13:27
* Author: SmarterVision - https://codecanyon.net/user/smartervision
* Copyright (c) 2021
*/
namespace App\Models;
use Eloquent as Model;
use Illuminate\Database\Eloquent\Relations\BelongsTo;
/**
* Class CustomFieldValue
* @package App\Models
* @version July 24, 2018, 9:13 pm UTC
*
* @property CustomField customField
* @property string value
* @property integer coupon_id
* @property string discountable_type
* @property integer discountable_id
*/
class Discountable extends Model
{
public $table = 'discountables';
public $timestamps = false;
public $fillable = [
'coupon_id',
'discountable_type',
'discountable_id'
];
/**
* The attributes that should be casted to native types.
*
* @var array
*/
protected $casts = [
'coupon_id' => 'integer',
'discountable_type' => 'string',
'discountable_id' => 'integer'
];
/**
* Validation rules
*
* @var array
*/
public static $rules = [
'coupon_id' => 'required|exists:coupon,id',
'discountable_type' => 'required',
'discountable_id' => 'required'
];
/**
* New Attributes
*
* @var array
*/
protected $appends = [
];
/**
* @return BelongsTo
**/
public function coupon()
{
return $this->belongsTo(Coupon::class, 'coupon_id', 'id');
}
public function discountable()
{
return $this->morphTo();
}
}