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:
parent
0ba8541370
commit
06b5009842
26 changed files with 106 additions and 109 deletions
app/Http/Controllers
|
@ -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);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue