Skip to content
Snippets Groups Projects
Commit b811a951 authored by Dominik Hebeler's avatar Dominik Hebeler
Browse files

We now catch the error in case of Database connection issues so that MetaGer works anyways

parent 6c68f3d4
No related branches found
No related tags found
No related merge requests found
......@@ -7,6 +7,8 @@ use Illuminate\Http\Request;
use Jenssegers\Agent\Agent;
use LaravelLocalization;
use Response;
use DB;
use Log;
class StartpageController extends Controller
{
......@@ -41,6 +43,14 @@ class StartpageController extends Controller
if ($lang === 'de' || $lang === "en") {
$lang = 'all';
}
# Sponsorenlinks
$sponsors = [];
try{
$sponsors = DB::table('sponsorenlinks')->where('langcode', 'de')->orderByRaw('LENGTH(linktext)', 'ASC')->get();
} catch(\Illuminate\Database\QueryException $e){
Log::info($e);
}
return view('index')
->with('title', trans('titles.index'))
......@@ -52,6 +62,7 @@ class StartpageController extends Controller
->with('request', $request->input('request', 'GET'))
->with('option_values', $option_values)
->with('autocomplete', $autocomplete)
->with('sponsors', $sponsors)
->with('pluginmodal', $request->input('plugin-modal', 'off'));
}
......
......@@ -25,7 +25,7 @@
<div id="sponsors">
<h2>{{ trans('index.sponsors.head.2') }}</h2>
<ul class="startpage">
@foreach(DB::table('sponsorenlinks')->where('langcode', 'de')->orderByRaw('LENGTH(linktext)', 'ASC')->get() as $link)
@foreach($sponsors as $link)
<li class="sponsor">
<a href="{{ $link->link }}" target="_blank" rel="noopener"><p>{{ $link->linktext }}</p> <i class="fa fa-external-link"></i></a>
</li>
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment