Fix 500 error on admin access: make navigation layout resilient and auto-run pending migrations on admin entry

This commit is contained in:
2026-11-02 10:38:22 +01:00
parent 44c440222a
commit cf55f3c9f9
7 changed files with 76 additions and 9 deletions
+9 -5
View File
@@ -8,6 +8,7 @@ use Illuminate\Http\RedirectResponse;
use Illuminate\Http\Request;
use Illuminate\Support\Facades\Auth;
use Illuminate\Support\Facades\Hash;
use Illuminate\Support\Facades\Schema;
use Illuminate\Validation\Rule;
use Illuminate\View\View;
@@ -26,11 +27,14 @@ class AccountController extends Controller
->latest()
->get();
$communications = Communication::where('user_id', $user->id)
->orWhere('email', strtolower($user->email))
->with('replies')
->latest()
->get();
$communications = collect();
if (Schema::hasTable('communications')) {
$communications = Communication::where('user_id', $user->id)
->orWhere('email', strtolower($user->email))
->with('replies')
->latest()
->get();
}
return view('account.index', compact('user', 'orders', 'communications'));
}