34 lines
675 B
PHP
34 lines
675 B
PHP
<?php
|
|
|
|
declare(strict_types=1);
|
|
|
|
namespace App\Request\Api;
|
|
|
|
use Hyperf\Validation\Request\FormRequest;
|
|
|
|
class LoginRequest extends FormRequest
|
|
{
|
|
/**
|
|
* 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 [
|
|
'login_type' => 'required|string|in:wx_login,mobile_code',
|
|
'js_code' => 'required_if:login_type,wx_login|string',
|
|
];
|
|
}
|
|
|
|
protected array $scenes = [
|
|
'login' => ['login_type', 'js_code'],
|
|
];
|
|
}
|