<?php

namespace App\Models\WS;

use Illuminate\Database\Eloquent\Model;

class Service extends Model
{
    protected $fillable = ['name', 'description', 'image', 'created_by', 'status','updated_by','bg_color','seq_no'];
    protected $casts = ['created_at' => 'date:d/m/Y'];
    protected $appends = ['image_url'];
    public function getImageUrlAttribute()
    {
        return asset('storage/website/' . $this->image);
    }
    public static function boot()
    {
        Parent::boot();
        static::creating(function ($model) {
            $model->created_by = auth()->id();
        });

        static::updating(function ($model) {
            $model->updated_by = auth()->id();
        });
    }
}
