adrema/app/Home/Actions/IndexAction.php

33 lines
640 B
PHP
Raw Normal View History

2022-11-17 02:15:29 +01:00
<?php
namespace App\Home\Actions;
use App\Home\DashboardFactory;
use Illuminate\Http\Request;
use Inertia;
use Inertia\Response;
use Lorisleiva\Actions\Concerns\AsAction;
class IndexAction
{
use AsAction;
/**
* @return array<array-key, mixed>
*/
public function handle(): array
{
return [
'blocks' => app(DashboardFactory::class)->render(),
];
}
public function asController(Request $request): Response
{
session()->put('menu', 'dashboard');
session()->put('title', 'Dashboard');
return Inertia::render('home/VIndex', $this->handle());
}
}