- This weekend, I updated the monday-shop system.
The most significant challenges came from upgrading laravel-admin to the latest version. This backend framework is particularly valuable as it allows developers to focus on core backend logic.
-
First Issue: Composer Dependency Errors
Initialcomposer install
failed due to locked mirror sources. Solved by switching to Alibaba Cloud Composer Mirror. -
Laravel-admin Upgrade Challenges
Key functionality affected:- Soft Delete (下架)
- Restore (上架)
-
Version-Specific Problems:
- Soft-deleted items couldn’t be processed by actions (throwing “model not found” errors)
- Force delete functionality failed (delete action only performed soft delete)
- Soft-deleted items couldn’t be processed by actions (throwing “model not found” errors)
Problem Solving Process
-
Controller Analysis
The controller’sdestroy
method contained force delete logic, but requests weren’t reaching it:
-
Routing Investigation
All actions routed throughHandleController::handleAction
:
-
Model Retrieval Issue
The critical line:$model = $action->retrieveModel($request);
Default implementation usedModel::findOrFail()
, incompatible with soft-deleted items:
-
Solution: Override
retrieveModel
in custom Action class to include soft-deleted records:
Force Delete Implementation
-
Default Action Analysis
DropdownActions
contained basic delete action:
-
Custom Force Delete Action
Removed default delete, added force delete implementation:
Core logic using Laravel’s force delete:
Final Outcome: Both soft delete management and force delete functionality now work as intended.