Fix 500 error on admin access: make navigation layout resilient and auto-run pending migrations on admin entry
This commit is contained in:
@@ -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'));
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user