Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
open-source
MetaGer
Commits
b811a951
Commit
b811a951
authored
Sep 21, 2018
by
Dominik Hebeler
Browse files
We now catch the error in case of Database connection issues so that MetaGer works anyways
parent
6c68f3d4
Changes
2
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
app/Http/Controllers/StartpageController.php
View file @
b811a951
...
...
@@ -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'
));
}
...
...
resources/views/index.blade.php
View file @
b811a951
...
...
@@ -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
>
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment