Файловый менеджер - Редактировать - /home/clickysoft/public_html/charliapp-v2.clickysoft.net/app/Models/Coupon.php
Назад
<?php namespace App\Models; use \DateTimeInterface; use Carbon\Carbon; use Illuminate\Database\Eloquent\Factories\HasFactory; use Illuminate\Database\Eloquent\Model; class Coupon extends Model { use HasFactory; public const STATUS_RADIO = [ '1' => 'Enable', '0' => 'Disable', ]; public const DISCOUNT_TYPE_RADIO = [ '0' => 'Fixed', '1' => 'Percent', ]; public const PACKAGE_TYPE_RADIO = [ 'Monthly' => 'Monthly', 'Yearly' => 'Yearly', 'Both' => 'Both', ]; public $table = 'coupons'; protected $dates = [ 'date_of_expiry', 'created_at', 'updated_at', 'deleted_at', ]; protected $fillable = [ 'coupon_code', 'package_id', 'package_type', 'discount_amount', 'discount_type', 'number_of_usage', 'usage_count', 'date_of_expiry', 'status', 'created_at', 'updated_at', 'deleted_at', ]; public function package() { return $this->belongsTo(Package::class, 'package_id'); } public function getDateOfExpiryAttribute($value) { return $value ? Carbon::parse($value)->format(config('panel.date_format')) : null; } public function setPackageIdAttribute($value) { $this->attributes['package_id'] = empty($value) ? null : $value; } public function setNumberOfUsageAttribute($value) { $this->attributes['number_of_usage'] = empty($value) ? null : $value; } public function setDateOfExpiryAttribute($value) { $this->attributes['date_of_expiry'] = $value ? Carbon::createFromFormat(config('panel.date_format'), $value)->format('Y-m-d') : null; } protected function serializeDate(DateTimeInterface $date) { return $date->format('Y-m-d H:i:s'); } }
| ver. 1.4 |
Github
|
.
| PHP 8.1.29 | Генерация страницы: 0 |
proxy
|
phpinfo
|
Настройка