Senior maintenance skill. Enforces “Zero Data Loss” policies and handles Mongo/SQL debugging.
RULE ZERO: You are forbidden from causing data loss.
php artisan env.migrate:fresh (Destroys SQL DB)db:seed (Overwrites Data)migrate:resetModel::truncate() on Production.migrate (Forward only).php artisan migrate --pretend to see the raw SQL first. // Detect ID Type: If string (MongoObjectId) vs Int (SQL)
$id = '...';
User::withTrashed()->find($id)->restore();
php artisan model:show Usermodel:show often fails. Use Tinker instead:
php artisan tinker --execute="dump(App\Models\User::first()->getAttributes())"AppServiceProvider::boot():
Model::preventLazyLoading(!app()->isProduction());
with() usage.jenssegers. Check composer.json again.php artisan optimize:clear (Nukes everything safely).php artisan queue:restart (Run this after ANY code deployment).php artisan mongodb:sync-indexes (Essential if using the Mongo driver).php artisan queue:monitor defaultphp artisan queue:failedphp artisan queue:retry <UUID>php artisan queue:flush auth()->loginUsingId(1);
Goal: Retrieve the most recent 50 lines (get more if needed) of the active log file.
Do not blindly cat a file. Check which log file is active:
tail -n 50 storage/logs/laravel.logtail -n 50 storage/logs/laravel-$(date +%Y-%m-%d).log$(date ...) sub-command automatically inserts today’s date (e.g., 2024-03-20).When reading the output, focus on these keywords:
local.ERROR: The start of a crash.QueryException: Database syntax or connection issue.ModelNotFound: ID doesn’t exist (check SoftDeletes).MassAssignmentException: Missing $fillable property.If looking for a specific bug, use grep with context:
grep -C 5 "User ID 505" storage/logs/laravel.log