ldc-gen-game-web/app/Http/Requests/StoreProductRequest.php

42 lines
973 B
PHP
Raw Permalink Normal View History

<?php
namespace App\Http\Requests;
use Illuminate\Foundation\Http\FormRequest;
2021-08-19 10:06:05 +02:00
use Illuminate\Validation\Rule;
class StoreProductRequest extends FormRequest
{
/**
* Determine if the user is authorized to make this request.
*
* @return boolean
*/
public function authorize()
{
return auth()->check();
}
/**
* Get the validation rules that apply to the request.
*
* @return array
*/
public function rules()
{
return [
'name' => 'required|string|min:2|max:255',
2022-08-11 07:33:30 +00:00
'code_ean' => 'required|numeric',
2021-08-19 10:06:05 +02:00
'picture' => [
2021-08-19 10:10:21 +02:00
'image',
'mimes:jpeg,png,jpg',
'max:2048',
Rule::dimensions()
->maxWidth(config('theme.product_image_maxwidth'))
->maxHeight(config('theme.product_image_maxheight'))
2021-08-19 10:06:05 +02:00
],
'range_id' => 'exists:ranges,id'
];
}
}