adrema/app/Dashboard/Actions/IndexAction.php

33 lines
655 B
PHP

<?php
namespace App\Dashboard\Actions;
use App\Dashboard\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('dashboard/VIndex', $this->handle());
}
}