You've already forked Atomcms-edit
Initial commit
This commit is contained in:
Executable
+31
@@ -0,0 +1,31 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Middleware;
|
||||
|
||||
use App\Models\Miscellaneous\WebsiteSetting;
|
||||
use Closure;
|
||||
use Illuminate\Http\Request;
|
||||
use Symfony\Component\HttpFoundation\Response;
|
||||
|
||||
class InjectPwaMeta
|
||||
{
|
||||
public function handle(Request $request, Closure $next): Response
|
||||
{
|
||||
$pwaEnabled = WebsiteSetting::where('key', 'pwa_enabled')->first()?->value === '1';
|
||||
|
||||
if ($pwaEnabled) {
|
||||
$config = [
|
||||
'name' => WebsiteSetting::where('key', 'pwa_name')->first()?->value ?? 'Epicnabbo',
|
||||
'short_name' => WebsiteSetting::where('key', 'pwa_short_name')->first()?->value ?? 'Epicnabbo',
|
||||
'theme_color' => WebsiteSetting::where('key', 'pwa_theme_color')->first()?->value ?? '#eeb425',
|
||||
];
|
||||
|
||||
view()->share('pwa_enabled', true);
|
||||
view()->share('pwa_config', $config);
|
||||
} else {
|
||||
view()->share('pwa_enabled', false);
|
||||
}
|
||||
|
||||
return $next($request);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user