48 lines
1.1 KiB
PHP
48 lines
1.1 KiB
PHP
<?php
|
|||
|
|
|
||
|
|
namespace App\Models;
|
||
|
|
|
||
|
|
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
||
|
|
use Illuminate\Database\Eloquent\Model;
|
||
|
|
use Illuminate\Database\Eloquent\SoftDeletes;
|
||
|
|
|
||
|
|
class OfferCode extends Model
|
||
|
|
{
|
||
|
|
use HasFactory,Selector,SoftDeletes;
|
||
|
|
protected $table='offer_codes';
|
||
|
|
protected $fillable=[
|
||
|
|
'code',
|
||
|
|
'title',
|
||
|
|
'description',
|
||
|
|
'start_at',
|
||
|
|
'end_at',
|
||
|
|
'type',
|
||
|
|
'discount_percent',
|
||
|
|
'discount_price',
|
||
|
|
'is_active',
|
||
|
|
'use_only',
|
||
|
|
'use_count'
|
||
|
|
];
|
||
|
|
static $TYPES = [
|
||
|
|
1=>"محصول",
|
||
|
|
2=>"دسته بندی",
|
||
|
|
3=>"مشتری",
|
||
|
|
4=>"برند",
|
||
|
|
5=>""
|
||
|
|
];
|
||
|
|
static $TYPE_CUSTOMER = [
|
||
|
|
1=>"تکی",
|
||
|
|
2=>"عمده",
|
||
|
|
];
|
||
|
|
protected $casts=[
|
||
|
|
'is_active' => 'boolean',
|
||
|
|
];
|
||
|
|
// public static function safeDelete($promotionID){
|
||
|
|
// Promotion::findOrFail($promotionID)->delete();
|
||
|
|
// PromotionItem::where('promotion_id',$promotionID)->delete();
|
||
|
|
// PromotionProduct::where('promotion_id',$promotionID)->delete();
|
||
|
|
// return true;
|
||
|
|
// }
|
||
|
|
|
||
|
|
}
|