Files
hyperf_service/app/Request/Api/LoginRequest.php
2025-03-19 16:56:38 +08:00

35 lines
759 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',
'phone_code' => 'required_if:login_type,wx_login|string',
];
}
protected array $scenes = [
'login' => ['login_type', 'js_code', 'phone_code'],
];
}