for testing and deploying your application
for finding and fixing issues
for empowering human code reviews
<?php
declare(strict_types=1);
namespace Cortex\Fort\Http\Requests\Frontend;
use Cortex\Fort\Models\User;
use Rinvex\Support\Http\Requests\FormRequest;
use Cortex\Foundation\Exceptions\GenericException;
class RegistrationProcessRequest extends FormRequest
{
/**
* Determine if the user is authorized to make this request.
*
* @throws \Cortex\Foundation\Exceptions\GenericException
* @return bool
*/
public function authorize()
if (! config('rinvex.fort.registration.enabled')) {
throw new GenericException(trans('cortex/fort::messages.register.disabled'));
}
return true;
* Process given request data before validation.
* @param array $data
* @return array
array<string,boolean|array>
This check looks for the generic type array as a return type and suggests a more specific type. This type is inferred from the actual code.
array
public function process($data)
$data['active'] = ! config('rinvex.fort.registration.moderated');
$data['roles'] = [config('rinvex.fort.registration.default_role')];
return $data;
* Configure the validator instance.
* @param \Illuminate\Validation\Validator $validator
* @return void
public function withValidator($validator)
$validator->after(function ($validator) {
$data = $this->all();
$password = $data['password'] ?? null;
if ($password && $password !== $data['password_confirmation']) {
$validator->errors()->add('password', trans('validation.confirmed', ['attribute' => 'password']));
});
* Get the validation rules that apply to the request.
public function rules()
return (new User())->getRules();
This check looks for the generic type
array
as a return type and suggests a more specific type. This type is inferred from the actual code.