<?php

namespace App\Http\Requests\API;

use Illuminate\Foundation\Http\FormRequest;

class OrderRequest extends FormRequest
{
    /**
     * Determine if the user is authorized to make this request.
     *
     * @return bool
     */
    public function authorize()
    {
        return auth()->check();
    }

    /**
     * Get the validation rules that apply to the request.
     *
     * @return array
     */
    public function rules()
    {
        return [
            'product_id'  => 'required|exists:wordpress.posts,id',
            // 'product_id'  => ['required', 'number', 'min:3'],
            'name'     => ['required', 'string', 'min:3'],
            'email'     => ['required', 'string', 'email'],
            'phone'     => ['required', 'string', 'min:8', 'max:16'],
            'success_url'     => ['required', 'string', 'url'],
            'failed_url'     => ['required', 'string', 'url'],
        ];
    }
}
