first commit
This commit is contained in:
28
Xboard/app/Models/Coupon.php
Normal file
28
Xboard/app/Models/Coupon.php
Normal file
@@ -0,0 +1,28 @@
|
||||
<?php
|
||||
|
||||
namespace App\Models;
|
||||
|
||||
use App\Services\PlanService;
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
|
||||
class Coupon extends Model
|
||||
{
|
||||
protected $table = 'v2_coupon';
|
||||
protected $dateFormat = 'U';
|
||||
protected $guarded = ['id'];
|
||||
protected $casts = [
|
||||
'created_at' => 'timestamp',
|
||||
'updated_at' => 'timestamp',
|
||||
'limit_plan_ids' => 'array',
|
||||
'limit_period' => 'array',
|
||||
'show' => 'boolean',
|
||||
];
|
||||
|
||||
public function getLimitPeriodAttribute($value)
|
||||
{
|
||||
return collect(json_decode((string) $value, true))->map(function ($item) {
|
||||
return PlanService::getPeriodKey($item);
|
||||
})->toArray();
|
||||
}
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user