Skip to content

Commit

Permalink
Fix docs
Browse files Browse the repository at this point in the history
  • Loading branch information
rubenvanassche committed Sep 15, 2023
1 parent 95105c2 commit 6cf75b1
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 8 deletions.
8 changes: 4 additions & 4 deletions docs/as-a-data-transfer-object/casts.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,10 +21,10 @@ class SongData extends Data
The `Format` property here is an `Enum` and looks like this:

```php
enum Format {
case cd;
case vinyl;
case cassette;
enum Format: string {
case cd = 'cd';
case vinyl = 'vinyl';
case cassette = 'cassette';
}
```

Expand Down
9 changes: 5 additions & 4 deletions tests/ValidationTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,22 +6,21 @@
use Illuminate\Database\Eloquent\Builder;
use Illuminate\Foundation\Application;
use Illuminate\Http\Request;
use Illuminate\Support\Facades\Route;
use Illuminate\Support\Facades\Validator as ValidatorFacade;
use Illuminate\Validation\Rules\Enum;
use Illuminate\Validation\Rules\Exists as LaravelExists;
use Illuminate\Validation\Rules\In as LaravelIn;
use Illuminate\Validation\ValidationException;
use Illuminate\Validation\Validator;

use function Pest\Laravel\mock;
use function PHPUnit\Framework\assertFalse;

use Spatie\LaravelData\Attributes\DataCollectionOf;
use Spatie\LaravelData\Attributes\MapInputName;
use Spatie\LaravelData\Attributes\MapName;
use Spatie\LaravelData\Attributes\MapOutputName;
use Spatie\LaravelData\Attributes\Validation\ArrayType;
use Spatie\LaravelData\Attributes\Validation\Bail;
use Spatie\LaravelData\Attributes\Validation\BooleanType;
use Spatie\LaravelData\Attributes\Validation\Email;
use Spatie\LaravelData\Attributes\Validation\Exists;
use Spatie\LaravelData\Attributes\Validation\In;
use Spatie\LaravelData\Attributes\Validation\IntegerType;
Expand Down Expand Up @@ -69,6 +68,8 @@
use Spatie\LaravelData\Tests\Fakes\Support\FakeInjectable;
use Spatie\LaravelData\Tests\Fakes\ValidationAttributes\PassThroughCustomValidationAttribute;
use Spatie\LaravelData\Tests\TestSupport\DataValidationAsserter;
use function Pest\Laravel\mock;
use function PHPUnit\Framework\assertFalse;

it('can validate a string', function () {
$dataClass = new class () extends Data {
Expand Down

0 comments on commit 6cf75b1

Please sign in to comment.