<?php

namespace App\Models;

use Illuminate\Database\Eloquent\Casts\Attribute;
use Illuminate\Database\Eloquent\Factories\HasFactory;
use Illuminate\Database\Eloquent\Model;

class ConsommationOption extends Model
{
    use HasFactory;

    protected $fillable = [
        'img',
        'name',
        'consommation_khw',
    ];

    protected $casts = [
        'consommation_khw' => 'integer',
    ];

    protected function img(): Attribute
    {
        return Attribute::make(
            get: fn($value, array $attributes) => \Storage::url($value),
        );
    }
}
