UploadReportRequest.php 765 Bytes
<?php

namespace App\Http\Container\AppSection\Requests;

use Hikoon\LaravelApi\Support\ApiRequest;
use Illuminate\Support\Facades\Auth;

class UploadReportRequest extends ApiRequest
{
    /**
     * @return void
     */
    protected function prepareForValidation(): void
    {
        $this->merge(['user_id' => (int)Auth::id()]);
    }

    /**
     * @return string[]
     */
    public function rules(): array
    {
        return [
            'name' => 'required|string',
            'url'  => 'required|url'
        ];
    }

    /**
     * @return string[]
     */
    public function messages(): array
    {
        return [
            'name.required' => '请输入原文件名',
            'url.required'  => '请输入链接地址'
        ];
    }
}