0
0
Fork 0
mirror of https://github.com/BookStackApp/BookStack.git synced 2025-05-19 06:31:30 +00:00

Standardised laravel validation to be array based

Converted from string-only-based validation.
Array based validation works nicer once you have validation classess or
advanced validation options.
This commit is contained in:
Dan Brown 2021-11-05 00:26:55 +00:00
parent 0ba8541370
commit 06b5009842
No known key found for this signature in database
GPG key ID: 46D9F943C24A2EF9
26 changed files with 106 additions and 109 deletions
app/Http/Controllers

View file

@ -36,8 +36,8 @@ class UserApiTokenController extends Controller
$this->checkPermissionOrCurrentUser('users-manage', $userId);
$this->validate($request, [
'name' => 'required|max:250',
'expires_at' => 'date_format:Y-m-d',
'name' => ['required', 'max:250'],
'expires_at' => ['date_format:Y-m-d'],
]);
$user = User::query()->findOrFail($userId);
@ -86,8 +86,8 @@ class UserApiTokenController extends Controller
public function update(Request $request, int $userId, int $tokenId)
{
$this->validate($request, [
'name' => 'required|max:250',
'expires_at' => 'date_format:Y-m-d',
'name' => ['required', 'max:250'],
'expires_at' => ['date_format:Y-m-d'],
]);
[$user, $token] = $this->checkPermissionAndFetchUserToken($userId, $tokenId);