lcly-data-admin/app/Http/Requestes/RiceShrimpWeeklyPriceStoreR...

42 lines
967 B
PHP

<?php
namespace App\Http\Requestes;
use App\Models\RiceShrimpWeeklyPrice;
use App\Rules\Quarter;
use Illuminate\Foundation\Http\FormRequest;
use Illuminate\Validation\Rule;
use Peidikeji\Keywords\Models\Keywords;
class RiceShrimpWeeklyPriceStoreRequest extends FormRequest
{
/**
* Get the validation rules that apply to the request.
*
* @return array
*/
public function rules()
{
return [
'year' => ['required', 'int'],
'week' => [
'required',
'int',
Rule::exists(Keywords::class, 'id')->where(function ($query) {
return $query->where('type_key', 'weeks-per-year');
}),
],
'price' => ['required', 'int'],
];
}
public function attributes()
{
return [
'year' => '年份',
'week' => '周',
'price' => '价格',
];
}
}