38 lines
832 B
PHP
38 lines
832 B
PHP
<?php
|
|
|
|
namespace App\Http\Requests\Nasa;
|
|
|
|
use Illuminate\Foundation\Http\FormRequest;
|
|
|
|
class NasaQueryRequest 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.
|
|
*
|
|
* @return array<string, \Illuminate\Contracts\Validation\ValidationRule|array<mixed>|string>
|
|
*/
|
|
public function rules(): array
|
|
{
|
|
return [
|
|
//
|
|
];
|
|
}
|
|
|
|
public function cleanQuery(): array
|
|
{
|
|
// 🧬 利用 Laravel 11 极其强大的 collect 简化闭环
|
|
return collect($this->query())->transform(function ($xValue) {
|
|
return is_null($xValue) ? '' : $xValue;
|
|
})->all();
|
|
}
|
|
|
|
}
|