| 1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253 |
- <?php
- namespace App\Http\Requests;
- use Illuminate\Foundation\Http\FormRequest;
- class SaveProductRequest extends FormRequest
- {
- /**
- * Determine if the user is authorized to make this request.
- *
- * @return bool
- */
- public function authorize()
- {
- return true; // todo just admin can save it
- }
- /**
- * Get the validation rules that apply to the request.
- *
- * @return array<string, mixed>
- */
- public function rules()
- {
- return [
- 'id' => 'required',
- 'series' => 'required|string',
- 'name' => 'required|string',
- 'name_for_form' => 'required|string',
- 'product_group' => 'required|string',
- 'price' => 'required|numeric',
- 'characteristics' => 'required|string',
- 'tech_description' => 'required|string',
- 'tech_description_short' => 'required|string',
- ];
- }
- public function messages()
- {
- return [
- 'series.required' => 'Не может быть пустым',
- 'name.required' => 'Не может быть пустым',
- 'name_for_form.required' => 'Не может быть пустым',
- 'product_group.required' => 'Не может быть пустым',
- 'price.required' => 'Не может быть пустым',
- 'characteristics.required' => 'Не может быть пустым',
- 'tech_description.required' => 'Не может быть пустым',
- 'tech_description_short.required' => 'Не может быть пустым',
- ];
- }
- }
|