reportify_mncl/app/Http/Requests/User/UpdateLoginDetailsRequest.php
2024-03-16 20:37:32 +01:00

34 lines
732 B
PHP

<?php
namespace Vanguard\Http\Requests\User;
use Vanguard\Http\Requests\Request;
use Vanguard\User;
class UpdateLoginDetailsRequest extends Request
{
/**
* Get the validation rules that apply to the request.
*
* @return array
*/
public function rules()
{
$user = $this->getUserForUpdate();
return [
'email' => 'required|email|unique:users,email,' . $user->id,
'username' => 'nullable|unique:users,username,' . $user->id,
'password' => 'nullable|min:8|confirmed'
];
}
/**
* @return \Illuminate\Routing\Route|object|string
*/
protected function getUserForUpdate()
{
return $this->route('user');
}
}