NASER aff gift card controller and models and routes

This commit is contained in:
gholak tala
2026-05-01 19:34:10 +00:00
parent e595249ba7
commit 562edfadd9
5 changed files with 294 additions and 0 deletions
+51
View File
@@ -0,0 +1,51 @@
<?php
namespace App\Models;
use Illuminate\Database\Eloquent\Factories\HasFactory;
use Illuminate\Database\Eloquent\Model;
use App\Models\GiftCardCodes;
class GiftCard extends Model
{
use HasFactory,Selector;
protected $table = 'giftcards';
protected $fillable = [
'customer_id',
'count',
'amount',
'total',
'unit',
'unique_code',
'created_at',
'sts',
'expiry_date',
'used_count',
'description',
'name',
'mobile',
];
public function giftcardcodes(){
return $this->hasMany(GiftCardCodes::class, 'giftcard_id', 'id');
}
static $STS = [
1 => "فعال",
2 => "تمام شده",
3 => "منقضی شده"
];
static $UNIT = [
1=>'IRR',
2=>'Golden'
];
public function getStsStrAttribute()
{
return self::$STS[$this->sts] ?? null;
}
}