2023-02-14 14:27:11 +01:00
|
|
|
<?php
|
|
|
|
|
|
|
|
namespace App\Activity\Actions;
|
|
|
|
|
|
|
|
use App\Activity;
|
|
|
|
use App\Activity\Resources\ActivityResource;
|
|
|
|
use Illuminate\Http\Resources\Json\AnonymousResourceCollection;
|
|
|
|
use Inertia\Inertia;
|
|
|
|
use Inertia\Response;
|
|
|
|
use Lorisleiva\Actions\ActionRequest;
|
|
|
|
use Lorisleiva\Actions\Concerns\AsAction;
|
|
|
|
|
|
|
|
class IndexAction
|
|
|
|
{
|
|
|
|
use AsAction;
|
|
|
|
|
2024-01-28 18:28:09 +01:00
|
|
|
public function handle(): AnonymousResourceCollection
|
2023-02-14 14:27:11 +01:00
|
|
|
{
|
2024-01-28 18:28:09 +01:00
|
|
|
return ActivityResource::collection(Activity::paginate(20));
|
2023-02-14 14:27:11 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
public function asController(ActionRequest $request): Response
|
|
|
|
{
|
2023-02-25 17:19:17 +01:00
|
|
|
session()->put('menu', 'activity');
|
|
|
|
session()->put('title', 'Tätigkeiten');
|
2023-02-23 22:43:13 +01:00
|
|
|
|
|
|
|
return Inertia::render('activity/VIndex', [
|
2024-01-28 18:28:09 +01:00
|
|
|
'data' => $this->handle(),
|
2023-02-14 14:27:11 +01:00
|
|
|
]);
|
|
|
|
}
|
|
|
|
}
|