generated from liutk/owl-admin-base
check
parent
de8e11dfae
commit
26c879b954
|
|
@ -18,12 +18,16 @@ class CheckUserRole
|
|||
{
|
||||
$user = auth('api')->user();
|
||||
$currentRole = $user->userRole();
|
||||
$hasPermissions = false;
|
||||
foreach ($currentRole as $role) {
|
||||
$roleValue = $role->value;
|
||||
if (!in_array($roleValue, $roles)) {
|
||||
throw new \App\Exceptions\RuntimeException('没有权限');
|
||||
if (in_array($roleValue, $roles)) {
|
||||
$hasPermissions = true;
|
||||
}
|
||||
}
|
||||
if (!$hasPermissions) {
|
||||
throw new \App\Exceptions\RuntimeException('没有权限');
|
||||
}
|
||||
return $next($request);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -28,6 +28,7 @@ return new class extends Migration
|
|||
$table->morphs('subject');
|
||||
$table->json('subject_data')->nullable('审核内容');
|
||||
$table->foreignId('employee_id')->nullable()->comment('申请人, employees.id');
|
||||
$table->timestamp('apply_at')->nullable()->comment('审批申请时间');
|
||||
$table->unsignedInteger('check_status')->default(CheckStatus::None->value)->comment('审核状态');
|
||||
$table->timestamp('checked_at')->nullable()->comment('审核通过时间');
|
||||
$table->string('check_remarks')->nullable()->comment('审核未通过原因');
|
||||
|
|
|
|||
|
|
@ -1,28 +0,0 @@
|
|||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
return new class extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*/
|
||||
public function up(): void
|
||||
{
|
||||
Schema::table('workflow_checks', function (Blueprint $table) {
|
||||
$table->timestamp('apply_at')->nullable()->comment('审批申请时间');
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*/
|
||||
public function down(): void
|
||||
{
|
||||
Schema::table('workflow_checks', function (Blueprint $table) {
|
||||
$table->dropColumn(['apply_at']);
|
||||
});
|
||||
}
|
||||
};
|
||||
Loading…
Reference in New Issue