d4da0a6d6a
* Disable CSRF token * Add error handling around looking up the theme and set a default * Note about logs in issue template * Formatting
32 lines
671 B
PHP
32 lines
671 B
PHP
<?php
|
|
|
|
namespace App\Http\Middleware;
|
|
|
|
use App\Contracts\Middleware;
|
|
use Closure;
|
|
use Igaster\LaravelTheme\Facades\Theme;
|
|
use Illuminate\Http\Request;
|
|
use Illuminate\Support\Facades\Log;
|
|
|
|
/**
|
|
* Read the current theme from the settings (set in admin), and set it
|
|
*/
|
|
class SetActiveTheme implements Middleware
|
|
{
|
|
public function handle(Request $request, Closure $next)
|
|
{
|
|
try {
|
|
$theme = setting('general.theme');
|
|
} catch (\Exception $e) {
|
|
Log::error($e->getMessage());
|
|
$theme = 'default';
|
|
}
|
|
|
|
if (!empty($theme)) {
|
|
Theme::set($theme);
|
|
}
|
|
|
|
return $next($request);
|
|
}
|
|
}
|