Remove Middleware
This commit is contained in:
parent
2056e1ad6b
commit
daf6e87814
|
@ -3,6 +3,7 @@
|
|||
namespace App\Setting\Actions;
|
||||
|
||||
use App\Setting\LocalSettings;
|
||||
use App\Setting\SettingFactory;
|
||||
use Inertia\Inertia;
|
||||
use Inertia\Response;
|
||||
use Lorisleiva\Actions\Concerns\AsAction;
|
||||
|
@ -16,6 +17,9 @@ class ViewAction
|
|||
session()->put('menu', 'setting');
|
||||
session()->put('title', $settingGroup::title());
|
||||
|
||||
return Inertia::render('setting/' . ucfirst($settingGroup::group()), $settingGroup->viewData());
|
||||
return Inertia::render('setting/' . ucfirst($settingGroup::group()), [
|
||||
...$settingGroup->viewData(),
|
||||
'setting_menu' => app(SettingFactory::class)->getShare(),
|
||||
]);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,26 +0,0 @@
|
|||
<?php
|
||||
|
||||
namespace App\Setting;
|
||||
|
||||
use Closure;
|
||||
use Illuminate\Http\Request;
|
||||
use Inertia;
|
||||
|
||||
class SettingMiddleware
|
||||
{
|
||||
/**
|
||||
* Handle an incoming request.
|
||||
*
|
||||
* @param \Closure(\Illuminate\Http\Request): (\Illuminate\Http\Response|\Illuminate\Http\RedirectResponse) $next
|
||||
*
|
||||
* @return \Illuminate\Http\Response|\Illuminate\Http\RedirectResponse
|
||||
*/
|
||||
public function handle(Request $request, Closure $next)
|
||||
{
|
||||
Inertia::share([
|
||||
'setting_menu' => app(SettingFactory::class)->getShare(),
|
||||
]);
|
||||
|
||||
return $next($request);
|
||||
}
|
||||
}
|
|
@ -23,7 +23,7 @@ class SettingServiceProvider extends ServiceProvider
|
|||
{
|
||||
app()->singleton(SettingFactory::class, fn () => new SettingFactory());
|
||||
app(Router::class)->bind('settingGroup', fn ($param) => app(SettingFactory::class)->resolveGroupName($param));
|
||||
app(Router::class)->middleware(['web', 'auth:web', SettingMiddleware::class])->get('/setting/{settingGroup}', ViewAction::class);
|
||||
app(Router::class)->middleware(['web', 'auth:web'])->get('/setting/{settingGroup}', ViewAction::class);
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
Loading…
Reference in New Issue