-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
897f7a2
commit 1d72d25
Showing
1 changed file
with
41 additions
and
0 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
<?php | ||
|
||
declare(strict_types=1); | ||
|
||
namespace App\DTO\Api\User\Request; | ||
|
||
use Illuminate\Http\UploadedFile; | ||
use Illuminate\Validation\Rule; | ||
use Spatie\LaravelData\Attributes\Validation\Image; | ||
use Spatie\LaravelData\Attributes\Validation\Max; | ||
use Spatie\LaravelData\Data; | ||
use Spatie\LaravelData\Support\Validation\ValidationContext; | ||
|
||
class UserUpdateDTO extends Data | ||
{ | ||
public function __construct( | ||
#[Image] | ||
public ?UploadedFile $image, | ||
#[Max(255)] | ||
public ?string $name, | ||
#[Max(255)] | ||
public ?string $surname, | ||
#[Max(255)] | ||
public ?string $patronymic, | ||
#[Max(255)] | ||
public ?string $email, | ||
#[Max(255)] | ||
public ?string $about, | ||
) { | ||
} | ||
|
||
public static function rules(ValidationContext $context): array | ||
{ | ||
return [ | ||
'email' => [ | ||
'email', | ||
Rule::unique('users', 'email')->ignore(auth()->id()), | ||
], | ||
]; | ||
} | ||
} |