[FEAT] 重構子帳號角色管理至子帳號頁籤,並全面標準化商品與機台模組 UI 樣式
Detail: - 將「子帳號角色」從全域資料設定移入子帳號管理頁籤項下 - 移除冗餘的子帳號角色獨立權限,整合入子帳號管理權限 - 標準化商品列表與分類列表的圖示容器、懸停變色與奢華風陰影 - 修正分類名稱 (Category Name) 在 zh_TW 中的多語系缺漏 - 同步優化機台列表與權限管理介面的圖示交互效果
This commit is contained in:
@@ -0,0 +1,48 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
use Illuminate\Support\Facades\DB;
|
||||
|
||||
return new class extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*/
|
||||
public function up(): void
|
||||
{
|
||||
// 1. 取得權限 ID
|
||||
$permission = DB::table('permissions')
|
||||
->where('name', 'menu.data-config.sub-account-roles')
|
||||
->first();
|
||||
|
||||
if ($permission) {
|
||||
// 2. 移除角色與該權限的關聯 (雖然 Spatie 通常會處理,但手動確保清理乾淨)
|
||||
DB::table('role_has_permissions')
|
||||
->where('permission_id', $permission->id)
|
||||
->delete();
|
||||
|
||||
// 3. 移除權限本身
|
||||
DB::table('permissions')
|
||||
->where('id', $permission->id)
|
||||
->delete();
|
||||
}
|
||||
|
||||
// 4. 清理權限快取 (如果有的話)
|
||||
try {
|
||||
app()[\Spatie\Permission\PermissionRegistrar::class]->forgetCachedPermissions();
|
||||
} catch (\Exception $e) {
|
||||
// 忽略快取清理失敗(例如在沒有 Redis 的環境中)
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*/
|
||||
public function down(): void
|
||||
{
|
||||
// 由於是要永久拿掉,down 邏輯通常不需要重建,
|
||||
// 若真要復原,應透過重跑 Seeder 或手動新增。
|
||||
}
|
||||
};
|
||||
Reference in New Issue
Block a user