You can generate a request by following command.
php artisan mojura:request [Request] [Module] [Directory] [--force]
php artisan mojura:request LoginUser Core
Generated Request file will be at app/Modules/CoreModule/Http/Requests/LoginUserRequest.php
Parameters
-
[Request]: The name of the request class you want to create (required).
-
[Module]: The module where the request class will be created (required).
-
[Directory]: The specific directory within the module where the request class will be placed (optional).
-
[--force]: If set, it will overwrite any existing request class with the same name (optional).
Request Class Implementation
<?php
namespace App\Modules\CoreModule\Http\Requests;
use InnoAya\Mojura\Core\Request;
class LoginRequest extends Request
{
/**
* Determine if the user is authorized to make this request.
*/
public function authorize(): bool
{
return true;
}
/**
* Get the validation rules that apply to the request.
*/
public function rules(): array
{
return [
'identifier' => 'string|required',
'password' => 'string|required',
];
}
}