<?php

namespace App\Models;

use Illuminate\Database\Eloquent\Factories\HasFactory;
use Illuminate\Database\Eloquent\Model;
use Spatie\MediaLibrary\HasMedia;
use Spatie\MediaLibrary\InteractsWithMedia;
class Setting extends Model implements HasMedia
{
    use InteractsWithMedia;
    use HasFactory;

    public function settingImage($mediaType)
    {
        $media = $this->getMedia($mediaType)->first();
        if ($media) {
            return $media->getUrl();
        }
        return asset('upload/No-Image.png');
    }
}
