add role route override and user data scope
This commit is contained in:
@@ -0,0 +1,52 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace App\Model;
|
||||
|
||||
use Hyperf\Database\Model\Relations\BelongsTo;
|
||||
use Hyperf\DbConnection\Model\Model;
|
||||
|
||||
/**
|
||||
* @property int $role_id
|
||||
* @property int $route_id
|
||||
* @property bool $allowed
|
||||
*/
|
||||
class RoleRouteOverride extends Model
|
||||
{
|
||||
protected ?string $table = 'role_route_overrides';
|
||||
|
||||
public bool $timestamps = false;
|
||||
|
||||
protected string $primaryKey = 'role_id';
|
||||
|
||||
public bool $incrementing = false;
|
||||
|
||||
protected array $fillable = [
|
||||
'role_id',
|
||||
'route_id',
|
||||
'allowed',
|
||||
];
|
||||
|
||||
protected array $casts = [
|
||||
'role_id' => 'integer',
|
||||
'route_id' => 'integer',
|
||||
'allowed' => 'boolean',
|
||||
];
|
||||
|
||||
/**
|
||||
* 所属角色
|
||||
*/
|
||||
public function role(): BelongsTo
|
||||
{
|
||||
return $this->belongsTo(Role::class, 'role_id');
|
||||
}
|
||||
|
||||
/**
|
||||
* 所属路由
|
||||
*/
|
||||
public function route(): BelongsTo
|
||||
{
|
||||
return $this->belongsTo(Route::class, 'route_id');
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user