ldc-jeusselin/app/Http/Requests/Bo/UpdateUserRequest.php
Jérémy Munsch de4dcfb283
Closes #2 and #4
- Add status checker + admin secure packages + upgrade enum + add sentry + upgrade to sitemap generator + bump to CRMV2
- Set customer role enum and user role enum
- Update customer migration to set roles
- phpcbf
- faker local to fr
- update lang
- composer update
- bump laravel ui
- Redo all user crud
- npm bump
- Create admin command
- rearrange views
- redo all auth system
- redo customer pro bo
2023-08-21 15:43:33 +02:00

42 lines
905 B
PHP

<?php
namespace App\Http\Requests\Bo;
use Illuminate\Validation\Rule;
class UpdateUserRequest extends StoreUserRequest
{
/**
* Prepare the data for validation.
*
* @return void
*/
public function prepareForValidation()
{
if (empty($this->post('password'))) {
$this->offsetUnset('password');
}
}
/**
* Get the validation rules that apply to the request.
*
* @return array
*/
public function rules()
{
return \array_merge(
parent::rules(),
[
'password' => 'sometimes|string|min:8',
'email' => [
'required',
'string',
'email',
'max:255',
(new Rule())->unique('users')->ignore($this->user->id)
]
]
);
}
}