<?php

namespace App\Models;

use Illuminate\Database\Eloquent\Model;

class Badgeable extends Model
{
    //
    protected $guarded  = ["id"];
    protected $cast = ["award_type" => 'integer'];

    public function badge()
    {
        return $this->belongsTo(Badge::class);
    }

    public function getAwardTypeNameAttribute(): string
    {
        return match($this->award_type) {
            1 => '主要標籤',
            2 => '次要標籤',
            default => '未知',
        };
    }
}
