1
0
mirror of https://github.com/invoiceninja/invoiceninja.git synced 2024-11-16 08:02:40 +01:00
invoiceninja/app/Http/Requests/CreateInvoiceAPIRequest.php

41 lines
987 B
PHP
Raw Normal View History

2017-01-30 20:40:43 +01:00
<?php
namespace App\Http\Requests;
2016-05-01 21:30:39 +02:00
2017-01-03 20:48:40 +01:00
use App\Models\Client;
2016-05-01 21:30:39 +02:00
class CreateInvoiceAPIRequest extends InvoiceRequest
{
/**
* Determine if the user is authorized to make this request.
*
* @return bool
*/
public function authorize()
{
return $this->user()->can('create', ENTITY_INVOICE);
}
/**
* Get the validation rules that apply to the request.
*
* @return array
*/
public function rules()
{
$rules = [
'email' => 'required_without:client_id',
'client_id' => 'required_without:email',
'invoice_items' => 'valid_invoice_items',
'invoice_number' => 'unique:invoices,invoice_number,,id,account_id,' . $this->user()->account_id,
'discount' => 'positive',
2016-08-15 21:57:05 +02:00
//'invoice_date' => 'date',
//'due_date' => 'date',
//'start_date' => 'date',
//'end_date' => 'date',
2016-05-01 21:30:39 +02:00
];
return $rules;
}
}