🚧 Submit export shows to trakt
Still very messy
This commit is contained in:
parent
f33031ed8b
commit
50c49cd0ef
8 changed files with 1615 additions and 68 deletions
31
app/Data/DataPipes/ReadExportFiles.php
Normal file
31
app/Data/DataPipes/ReadExportFiles.php
Normal file
|
|
@ -0,0 +1,31 @@
|
|||
<?php
|
||||
|
||||
namespace App\Data\DataPipes;
|
||||
|
||||
use App\Data\FileData;
|
||||
use Illuminate\Support\Collection;
|
||||
use Spatie\LaravelData\DataPipes\DataPipe;
|
||||
use Spatie\LaravelData\Lazy;
|
||||
use Spatie\LaravelData\Optional;
|
||||
use Spatie\LaravelData\Support\DataClass;
|
||||
use Spatie\LaravelData\Support\DataConfig;
|
||||
use Spatie\LaravelData\Support\DataProperty;
|
||||
|
||||
class ReadExportFiles implements DataPipe
|
||||
{
|
||||
public function handle(mixed $payload, DataClass $class, Collection $properties): Collection
|
||||
{
|
||||
if (!$properties->has('files') || !$properties->get('files')->count()) {
|
||||
return $properties;
|
||||
}
|
||||
|
||||
$data = [];
|
||||
foreach ($properties->get('files') as $file)
|
||||
{
|
||||
$data[] = $file->rawData;
|
||||
}
|
||||
$properties['rawData'] = $data;
|
||||
|
||||
return $properties;
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue