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
|
|
|
|
{
|
2024-09-22 12:28:10 +02:00
|
|
|
return ResourceData::collect($fileshare->type->getSubDirectories($request->input('parent')), DataCollection::class)->wrap('data');
|
2024-06-28 23:56:34 +02:00
|
|
|
}
|
|
|
|
}
|