687681744a
git commit "Implement user registration"
49 lines
855 B
PHP
49 lines
855 B
PHP
<?php
|
|
|
|
/**
|
|
* Created by Reliese Model.
|
|
*/
|
|
|
|
namespace App\Models;
|
|
|
|
use Carbon\Carbon;
|
|
use Illuminate\Database\Eloquent\Collection;
|
|
use Illuminate\Database\Eloquent\Model;
|
|
|
|
/**
|
|
* Class Role
|
|
*
|
|
* @property int $id
|
|
* @property string $name
|
|
* @property string $slug
|
|
* @property string $description
|
|
* @property Carbon $created_at
|
|
* @property Carbon $updated_at
|
|
*
|
|
* @property Collection|Admin[] $admins
|
|
* @property Collection|Permission[] $permissions
|
|
*
|
|
* @package App\Models
|
|
*/
|
|
class Role extends Model
|
|
{
|
|
protected $table = 'roles';
|
|
public static $snakeAttributes = false;
|
|
|
|
protected $fillable = [
|
|
'name',
|
|
'slug',
|
|
'description'
|
|
];
|
|
|
|
public function admins()
|
|
{
|
|
return $this->belongsToMany(Admin::class, 'admin_roles');
|
|
}
|
|
|
|
public function permissions()
|
|
{
|
|
return $this->belongsToMany(Permission::class, 'role_permissions');
|
|
}
|
|
}
|