|
|
|
|
@ -8,6 +8,7 @@ use Illuminate\Support\Facades\Schema;
|
|
|
|
|
use Illuminate\Support\Facades\DB;
|
|
|
|
|
use Illuminate\Support\Str;
|
|
|
|
|
use OwenIt\Auditing\Contracts\Auditable;
|
|
|
|
|
use Spatie\Permission\Models\Role;
|
|
|
|
|
|
|
|
|
|
class CommonModel extends Model
|
|
|
|
|
{
|
|
|
|
|
@ -132,4 +133,19 @@ class CommonModel extends Model
|
|
|
|
|
$router->post("{$prefix}/update/{id?}", "{$controller}@update");
|
|
|
|
|
$router->post("{$prefix}/delete", "{$controller}@delete");
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* 判断是否有导出权限
|
|
|
|
|
*/
|
|
|
|
|
public static function checkExport()
|
|
|
|
|
{
|
|
|
|
|
$userId = auth()->id();
|
|
|
|
|
$roleId = Role::where('name', 'like', '%导出%')->where('guard_name', 'admin')->value('id');
|
|
|
|
|
return DB::table('model_has_roles')
|
|
|
|
|
->where('role_id', $roleId)
|
|
|
|
|
->where('model_type', 'App\Admin')
|
|
|
|
|
->where('model_id', $userId)
|
|
|
|
|
->count();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|