🚧 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
26
app/Data/DataPipes/ReadExportFile.php
Normal file
26
app/Data/DataPipes/ReadExportFile.php
Normal file
|
|
@ -0,0 +1,26 @@
|
|||
<?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 ReadExportFile implements DataPipe
|
||||
{
|
||||
public function handle(mixed $payload, DataClass $class, Collection $properties): Collection
|
||||
{
|
||||
if (!$properties->has('path')) {
|
||||
return $properties;
|
||||
}
|
||||
|
||||
$properties['rawData'] = json_decode(file_get_contents($properties->get('path')), true) ?? [];
|
||||
|
||||
return $properties;
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue