adrema/app/Fileshare/Actions/ListFilesAction.php

23 lines
564 B
PHP
Raw Normal View History

2024-06-28 23:56:34 +02:00
<?php
namespace App\Fileshare\Actions;
use App\Fileshare\Data\ResourceData;
use App\Fileshare\Models\Fileshare;
use Lorisleiva\Actions\ActionRequest;
use Lorisleiva\Actions\Concerns\AsAction;
use Spatie\LaravelData\DataCollection;
class ListFilesAction
{
use AsAction;
2024-06-29 11:18:40 +02:00
/**
* @return DataCollection<int, ResourceData>
*/
2024-06-28 23:56:34 +02:00
public function handle(ActionRequest $request, Fileshare $fileshare): DataCollection
{
return ResourceData::collection($fileshare->type->getSubDirectories($request->input('parent')))->wrap('data');
}
}