<?php

namespace App\Models;

use Illuminate\Database\Eloquent\Model;
use App\Traits\Searchable;
use Illuminate\Database\Eloquent\Casts\Attribute;
use Illuminate\Database\Eloquent\Factories\HasFactory;
use App\Constants\Status;

class SocialMedia extends Model
{
    use HasFactory, Searchable;
    protected $table = 'social_medias';

    protected function statusBadge(): Attribute
    {
        return Attribute::make(function () {
            $html = '';
            switch ($this->status) {
                case Status::ENABLE:
                    $html = '<span class="badge badge--success">' . trans('Active') . '</span>';
                    break;
                case Status::DISABLE:
                    $html = '<span><span class="badge badge--danger">' . trans('Deactive') . '</span></span>';
                    break;
            }
            return $html;
        });
    }
}
