1
0
mirror of https://github.com/flarum/core.git synced 2025-07-31 13:40:20 +02:00

Move view logic into middleware

This commit is contained in:
Toby Zerner
2017-11-29 22:25:57 +10:30
parent 92de751154
commit b806dc3db2
3 changed files with 39 additions and 19 deletions

View File

@@ -2,7 +2,7 @@
@section('content')
<p>
{{ $translator->trans('core.views.error.404_message') }}
{{ $message }}
</p>
<p>
<a href="{{ $app->url() }}">

View File

@@ -2,21 +2,6 @@
@section('content')
<p>
{{-- TODO: Change below to @php when Laravel is upgraded --}}
<?php
$getTranslationIfExists = function ($code) use ($translator, $settings) {
$key = 'core.views.error.'.$code.'_message';
$translation = $translator->trans($key, ['{forum}' => $settings->get('forum_title')]);
return $translation === $key ? false : $translation;
};
if (! $translation = $getTranslationIfExists($error->getCode())) {
if (! $translation = $getTranslationIfExists(500)) {
$translation = 'An error occurred while trying to load this page.';
}
}
?>
{{ $translation }}
{{ $message }}
</p>
@endsection