26 lines
512 B
PHP
26 lines
512 B
PHP
<?php
|
|
|
|
namespace App\Models;
|
|
|
|
use Illuminate\Database\Eloquent\Model;
|
|
|
|
class Promocode extends Model
|
|
{
|
|
//
|
|
protected $table = 'promocodes';
|
|
protected $guarded = [];
|
|
|
|
public function getMember()
|
|
{
|
|
return $this->hasOne(Member::class, 'id', 'used_count');
|
|
}
|
|
public function getFromLabelAttribute()
|
|
{
|
|
return match ($this->from) {
|
|
'cafeg' => '朗立臣',
|
|
'teamaster' => '飲力星球',
|
|
default => '未知來源',
|
|
};
|
|
}
|
|
}
|