Commit c1cf1208 authored by Dominik Hebeler's avatar Dominik Hebeler

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

parent 58c80d4a
......@@ -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>
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment