27 lines
620 B
PHP
27 lines
620 B
PHP
<?php
|
|
|
|
namespace App\Models;
|
|
|
|
use Illuminate\Database\Eloquent\Model;
|
|
|
|
class Permission extends Model
|
|
{
|
|
protected $table = 'permissions';
|
|
protected $primaryKey = 'permission_id';
|
|
protected $fillable = [
|
|
'permission_name',
|
|
];
|
|
|
|
protected $hidden = [
|
|
'created_at',
|
|
'updated_at',
|
|
];
|
|
|
|
// Permissions are linked to users by the user_permissions table
|
|
// User permissions are linked to users by the user_id and are valid per date
|
|
public function users()
|
|
{
|
|
return $this->belongsToMany(User::class, 'user_permissions', 'permission_id', 'user_id');
|
|
}
|
|
|
|
}
|