App\Http\Requests\UpdateInvoiceAPIRequest::rules PHP Method

rules() public method

Get the validation rules that apply to the request.
public rules ( ) : array
return array
    public function rules()
    {
        if ($this->action == ACTION_ARCHIVE) {
            return [];
        }
        $invoiceId = $this->entity()->id;
        $rules = ['invoice_items' => 'valid_invoice_items', 'invoice_number' => 'unique:invoices,invoice_number,' . $invoiceId . ',id,account_id,' . $this->user()->account_id, 'discount' => 'positive'];
        return $rules;
    }
UpdateInvoiceAPIRequest