ldc-boutique-cnc/app/Http/Requests/ProductRequest.php
2022-08-25 12:26:43 +02:00

39 lines
1.1 KiB
PHP

<?php
namespace App\Http\Requests;
use Illuminate\Foundation\Http\FormRequest;
use Illuminate\Support\Facades\Auth;
class ProductRequest extends FormRequest
{
/**
* Determine if the user is authorized to make this request.
*
* @return boolean
*/
public function authorize()
{
return Auth::guard('web')->check();
}
/**
* Get the validation rules that apply to the request.
*
* @return array
*/
public function rules()
{
return [
'name' => 'required|string|max:255',
'description' => 'required',
'picture' => 'image|mimes:jpeg,png,jpg|max:2048|dimensions:max_width=' .
config('theme.product_image_maxwidth') . ',max_height=' .
config('theme.product_image_maxheight'),
'picture_large' => 'image|mimes:jpeg,png,jpg|max:2048|dimensions:max_width=' .
config('theme.product_image_large_maxwidth') . ',max_height=' .
config('theme.product_image_large_maxheight'),
'price' => 'required|min:0|numeric',
];
}
}