feat(production): 優化生產單 BOM 原物料選取邏輯,支援商品 -> 倉庫 -> 批號連動與 API 分佈查詢
This commit is contained in:
@@ -0,0 +1,37 @@
|
||||
<?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
|
||||
{
|
||||
// 刪除 purchase_orders.publish 權限
|
||||
\Spatie\Permission\Models\Permission::where('name', 'purchase_orders.publish')->delete();
|
||||
|
||||
// 重置權限快取
|
||||
app()[\Spatie\Permission\PermissionRegistrar::class]->forgetCachedPermissions();
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*/
|
||||
public function down(): void
|
||||
{
|
||||
// 恢復權限(如果需要回滾)
|
||||
\Spatie\Permission\Models\Permission::firstOrCreate(['name' => 'purchase_orders.publish']);
|
||||
|
||||
// 重新分配給 admin (簡單恢復,可能無法完全還原所有角色配置)
|
||||
$admin = \Spatie\Permission\Models\Role::where('name', 'admin')->first();
|
||||
if ($admin) {
|
||||
$admin->givePermissionTo('purchase_orders.publish');
|
||||
}
|
||||
|
||||
app()[\Spatie\Permission\PermissionRegistrar::class]->forgetCachedPermissions();
|
||||
}
|
||||
};
|
||||
@@ -30,7 +30,7 @@ class PermissionSeeder extends Seeder
|
||||
'purchase_orders.create',
|
||||
'purchase_orders.edit',
|
||||
'purchase_orders.delete',
|
||||
'purchase_orders.publish',
|
||||
|
||||
|
||||
// 庫存管理
|
||||
'inventory.view',
|
||||
@@ -132,7 +132,7 @@ class PermissionSeeder extends Seeder
|
||||
$admin->givePermissionTo([
|
||||
'products.view', 'products.create', 'products.edit', 'products.delete',
|
||||
'purchase_orders.view', 'purchase_orders.create', 'purchase_orders.edit',
|
||||
'purchase_orders.delete', 'purchase_orders.publish',
|
||||
'purchase_orders.delete',
|
||||
'inventory.view', 'inventory.view_cost', 'inventory.delete',
|
||||
'inventory_count.view', 'inventory_count.create', 'inventory_count.edit', 'inventory_count.delete',
|
||||
'inventory_adjust.view', 'inventory_adjust.create', 'inventory_adjust.edit', 'inventory_adjust.delete',
|
||||
|
||||
Reference in New Issue
Block a user