Show if there are database errors
This commit is contained in:
@@ -5,6 +5,7 @@ namespace App\Http\Controllers\Frontend;
|
||||
use App\Interfaces\Controller;
|
||||
use App\Models\User;
|
||||
use Illuminate\Database\QueryException;
|
||||
use Log;
|
||||
|
||||
/**
|
||||
* Class HomeController
|
||||
@@ -18,6 +19,12 @@ class HomeController extends Controller
|
||||
{
|
||||
try {
|
||||
$users = User::orderBy('created_at', 'desc')->take(4)->get();
|
||||
debug($users);
|
||||
} catch (\PDOException $e) {
|
||||
Log::emergency($e);
|
||||
return view('system/errors/database_error', [
|
||||
'error' => $e->getMessage(),
|
||||
]);
|
||||
} catch (QueryException $e) {
|
||||
return view('system/errors/not_installed');
|
||||
}
|
||||
|
||||
@@ -36,3 +36,13 @@ services:
|
||||
- ./docker/data/mysql:/var/lib/mysql
|
||||
ports:
|
||||
- 3306:3306
|
||||
|
||||
# Use this to tail the logs so it's just all in a single window
|
||||
logs:
|
||||
image: busybox
|
||||
command: tail -f /var/www/storage/logs/laravel.log
|
||||
restart: always
|
||||
volumes:
|
||||
- ./:/var/www
|
||||
depends_on:
|
||||
- app
|
||||
|
||||
@@ -1,3 +1,13 @@
|
||||
FROM php:7.3-fpm
|
||||
|
||||
RUN docker-php-ext-install mysqli pdo openssl mbstring tokenizer curl json gmp
|
||||
RUN docker-php-ext-install \
|
||||
mysqli \
|
||||
pdo \
|
||||
openssl \
|
||||
mbstring \
|
||||
tokenizer \
|
||||
curl \
|
||||
json \
|
||||
gmp
|
||||
|
||||
RUN ln -sf /dev/stderr /var/log/fpm-error.log
|
||||
|
||||
@@ -10,3 +10,6 @@ pm.max_children = 5
|
||||
pm.start_servers = 2
|
||||
pm.min_spare_servers = 1
|
||||
pm.max_spare_servers = 3
|
||||
|
||||
php_flag[display_errors] = on
|
||||
php_admin_flag[log_errors] = on
|
||||
|
||||
@@ -62,7 +62,7 @@
|
||||
<div class="row">
|
||||
<div class="col-12">
|
||||
<h2>Database Error</h2>
|
||||
@yield('content')
|
||||
{{ $error }}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
Reference in New Issue
Block a user