♻️ Replace App\Model with App\Data

This commit is contained in:
Dan Jones 2022-08-19 19:52:56 -05:00
commit 7f4f005302
12 changed files with 393 additions and 222 deletions

19
app/Data/Casts/File.php Normal file
View file

@ -0,0 +1,19 @@
<?php
namespace App\Data\Casts;
use App\Exceptions\Quit;
use Spatie\LaravelData\Casts\Cast;
use Spatie\LaravelData\Support\DataProperty;
class File implements Cast
{
public function cast(DataProperty $property, mixed $file, array $context): mixed
{
if (!file_exists($file)) {
throw new Quit("$file is not a valid file");
}
return realpath($file);
}
}