Server : Apache System : Linux 145.162.205.92.host.secureserver.net 5.14.0-611.45.1.el9_7.x86_64 #1 SMP PREEMPT_DYNAMIC Wed Apr 1 05:56:53 EDT 2026 x86_64 User : tradze ( 1001) PHP Version : 8.1.34 Disable Function : NONE Directory : /home/tradze/www/app/Modules/Vouchers/Models/ |
<?php
namespace App\Modules\Vouchers\Models;
use Cviebrock\EloquentSluggable\Sluggable;
use Illuminate\Database\Eloquent\Model;
use Illuminate\Database\Eloquent\SoftDeletes;
use Illuminate\Support\Facades\Storage;
class VoucherOffer extends Model
{
use SoftDeletes;
use Sluggable;
/**
* The database table used by the model.
*
* @var string
*/
protected $table="vouchers_offers";
/**
* The attributes that are mass assignable.
*
* @var array
*/
protected $fillable = ['name','slug','body','buy', 'body', 'bonus','usage_limit','is_active','counter','is_promoted','starts_from','edited_by_id'];
/**
* Return the sluggable configuration array for this model.
*
* @return array
*/
public function sluggable():array
{
return [
'slug' => [
'source' => 'name'
]
];
}
// /**
// * Get the route key for the model.
// *
// * @return string
// */
// public function getRouteKeyName()
// {
// return 'slug';
// }
/**
* The service duration options that belong to the offer.
*
* @return \Illuminate\Database\Eloquent\Relations\BelongsToMany
*/
public function duration_options()
{
return $this->belongsToMany('App\Modules\Services\Models\ServiceDuration','vouchers_offers_options', 'offer_id', 'service_duration_id');
}
/**
* Get all of the voucher's codes.
*/
public function codes()
{
return $this->morphMany('App\Modules\Vouchers\Models\Voucher', 'parentable');
}
}