<?php

namespace App\Models;

use Illuminate\Database\Eloquent\Factories\HasFactory;
use Illuminate\Database\Eloquent\Model;
use Illuminate\Database\Eloquent\SoftDeletes;
use DateTimeInterface;

class Site extends Model
{
    use HasFactory;
    use SoftDeletes;

    protected $table='sites';
    protected $appends= ['limit_role_arr'];

    protected function serializeDate(DateTimeInterface $date)
    {
        return $date->format('Y-m-d H:i:s');
    }

    public function getLimitRoleArrAttribute()
    {
        $role= trim($this->attributes['limit_role'],',');
        return explode(',', $role);
    }
}
