<?php
/*=========================================================================================
    App Name  : eCase File PTUN Jakarta
    File Name : Role
    --------------------------------------------------------------------------------------
    Author    : Fuad Auliya Rohman
    Email     : fuad.dev16@gmail.com
==========================================================================================*/
namespace Modules\Role\Entities;

use App\Models\User;
use Spatie\Permission\Models\Role as RoleModel;
use App\Traits\ActivityLogTrait;

class Role extends RoleModel
{
    use ActivityLogTrait;

    protected $table = 'roles';

    protected $fillable = ['name', 'guard_name', 'startup_page'];

    public function getNameAttribute($value)
    {
        return ucwords($value);
    }

    public function setNameAttribute($value)
    {
        $this->attributes['name'] = ucfirst($value);
    }

    public function user()
    {
        return $this->hasMany(User::class, 'role_id', 'id');
    }
}

