You could put the logic in a (before) filter that does the database check, then redirects to your database-free controller.
It does depend, however, on whether you're checking if the database exists, or a table within a database exists. The former may be trickier, given that you'll get a database error trying to connect to the non-existent database.
You could always catch Laravel's database exception and perform your redirect on that.
Hi deringer
Adding an App:error catch in global.php looks like a suitable method. But using the following code does not work as per this thread, so I have asked the question why on there: http://laravel.io/forum/09-08-2014-how-to-create-custom-query-error-exception
App::error(function(QueryException $exception, $code)
{
// My logic here;
});
This works, so I will try this, thanks a lot for the help...
App::error(function (\Illuminate\Database\QueryException $e) {
// Logic here
});
Sign in to participate in this thread!
The Laravel portal for problem solving, knowledge sharing and community building.
The community