- 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
monday-shop
Key functionality affected:- Soft Delete (下架)
- Restore (上架)
-
Version-Specific Problems:
Problem Solving Process
-
Controller Analysis
The controller’sdestroy
method contained force delete logic, but requests weren’t reaching it:
monday-shop -
Routing Investigation
All actions routed throughHandleController::handleAction
:
monday-shop -
Model Retrieval Issue
The critical line:$model = $action->retrieveModel($request);
Default implementation usedModel::findOrFail()
, incompatible with soft-deleted items:
monday-shop -
Solution: Override
retrieveModel
in custom Action class to include soft-deleted records:
monday-shop
Force Delete Implementation
-
Default Action Analysis
DropdownActions
contained basic delete action:
monday-shop -
Custom Force Delete Action
Removed default delete, added force delete implementation:
monday-shop
Core logic using Laravel’s force delete:
monday-shop
Final Outcome: Both soft delete management and force delete functionality now work as intended.