generated from spatie/package-skeleton-laravel
-
-
Notifications
You must be signed in to change notification settings - Fork 221
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'main' into beyond-data
# Conflicts: # CHANGELOG.md # docs/advanced-usage/validation-attributes.md # src/Transformers/DataTransformer.php
- Loading branch information
Showing
16 changed files
with
399 additions
and
16 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
<?php | ||
|
||
namespace Spatie\LaravelData\Attributes\Validation; | ||
|
||
use Attribute; | ||
use Illuminate\Support\Arr; | ||
use Spatie\LaravelData\Support\Validation\References\RouteParameterReference; | ||
|
||
#[Attribute(Attribute::TARGET_PROPERTY | Attribute::TARGET_PARAMETER)] | ||
class DoesntEndWith extends StringValidationAttribute | ||
{ | ||
protected string|array $values; | ||
|
||
public function __construct(string|array|RouteParameterReference ...$values) | ||
{ | ||
$this->values = Arr::flatten($values); | ||
} | ||
|
||
public static function keyword(): string | ||
{ | ||
return 'doesnt_end_with'; | ||
} | ||
|
||
public function parameters(): array | ||
{ | ||
return [$this->values]; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
<?php | ||
|
||
namespace Spatie\LaravelData\Attributes\Validation; | ||
|
||
use Attribute; | ||
use Illuminate\Support\Arr; | ||
use Spatie\LaravelData\Support\Validation\References\RouteParameterReference; | ||
|
||
#[Attribute(Attribute::TARGET_PROPERTY | Attribute::TARGET_PARAMETER)] | ||
class DoesntStartWith extends StringValidationAttribute | ||
{ | ||
protected string|array $values; | ||
|
||
public function __construct(string|array|RouteParameterReference ...$values) | ||
{ | ||
$this->values = Arr::flatten($values); | ||
} | ||
|
||
public static function keyword(): string | ||
{ | ||
return 'doesnt_start_with'; | ||
} | ||
|
||
public function parameters(): array | ||
{ | ||
return [$this->values]; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
<?php | ||
|
||
namespace Spatie\LaravelData\Attributes\Validation; | ||
|
||
use Attribute; | ||
use Spatie\LaravelData\Support\Validation\References\FieldReference; | ||
|
||
#[Attribute(Attribute::TARGET_PROPERTY | Attribute::TARGET_PARAMETER)] | ||
class ExcludeWith extends StringValidationAttribute | ||
{ | ||
protected FieldReference $field; | ||
|
||
public function __construct( | ||
string|FieldReference $field, | ||
) { | ||
$this->field = $this->parseFieldReference($field); | ||
} | ||
|
||
public static function keyword(): string | ||
{ | ||
return 'exclude_with'; | ||
} | ||
|
||
public function parameters(): array | ||
{ | ||
return [$this->field]; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
<?php | ||
|
||
namespace Spatie\LaravelData\Attributes\Validation; | ||
|
||
use Attribute; | ||
|
||
#[Attribute(Attribute::TARGET_PROPERTY | Attribute::TARGET_PARAMETER)] | ||
class Lowercase extends StringValidationAttribute | ||
{ | ||
public static function keyword(): string | ||
{ | ||
return 'lowercase'; | ||
} | ||
|
||
public function parameters(): array | ||
{ | ||
return []; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
<?php | ||
|
||
namespace Spatie\LaravelData\Attributes\Validation; | ||
|
||
use Attribute; | ||
use Spatie\LaravelData\Support\Validation\References\RouteParameterReference; | ||
|
||
#[Attribute(Attribute::TARGET_PROPERTY | Attribute::TARGET_PARAMETER)] | ||
class MaxDigits extends StringValidationAttribute | ||
{ | ||
public function __construct(protected int|RouteParameterReference $value) | ||
{ | ||
} | ||
|
||
public static function keyword(): string | ||
{ | ||
return 'max_digits'; | ||
} | ||
|
||
public function parameters(): array | ||
{ | ||
return [$this->value]; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
<?php | ||
|
||
namespace Spatie\LaravelData\Attributes\Validation; | ||
|
||
use Attribute; | ||
use Spatie\LaravelData\Support\Validation\References\RouteParameterReference; | ||
|
||
#[Attribute(Attribute::TARGET_PROPERTY | Attribute::TARGET_PARAMETER)] | ||
class MinDigits extends StringValidationAttribute | ||
{ | ||
public function __construct(protected int|RouteParameterReference $value) | ||
{ | ||
} | ||
|
||
public static function keyword(): string | ||
{ | ||
return 'min_digits'; | ||
} | ||
|
||
public function parameters(): array | ||
{ | ||
return [$this->value]; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
<?php | ||
|
||
namespace Spatie\LaravelData\Attributes\Validation; | ||
|
||
use Attribute; | ||
|
||
#[Attribute(Attribute::TARGET_PROPERTY | Attribute::TARGET_PARAMETER)] | ||
class Uppercase extends StringValidationAttribute | ||
{ | ||
public static function keyword(): string | ||
{ | ||
return 'uppercase'; | ||
} | ||
|
||
public function parameters(): array | ||
{ | ||
return []; | ||
} | ||
} |
Oops, something went wrong.