first commit

This commit is contained in:
denisdulici
2017-09-14 22:21:00 +03:00
commit 515bdaf5cd
598 changed files with 48030 additions and 0 deletions

View File

@ -0,0 +1,49 @@
<?php
namespace App\Http\Requests\Income;
use App\Http\Requests\Request;
class Customer extends Request
{
/**
* 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()
{
$required = '';
// Check if store or update
if ($this->getMethod() == 'PATCH') {
$id = $this->customer->getAttribute('id');
} else {
$id = null;
}
if (!empty($this->request->get('create_user'))) {
$required = 'required|';
}
// Get company id
$company_id = $this->request->get('company_id');
return [
'name' => 'required|string',
'email' => 'required|email|unique:customers,NULL,' . $id . ',id,company_id,' . $company_id . ',deleted_at,NULL',
'currency_code' => 'required|string',
'password' => $required . 'confirmed',
];
}
}

View File

@ -0,0 +1,45 @@
<?php
namespace App\Http\Requests\Income;
use App\Http\Requests\Request;
class Invoice extends Request
{
/**
* 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()
{
// Check if store or update
if ($this->getMethod() == 'PATCH') {
$id = $this->invoice->getAttribute('id');
} else {
$id = null;
}
// Get company id
$company_id = $this->request->get('company_id');
return [
'customer_id' => 'required|integer',
'invoice_number' => 'required|string|unique:invoices,NULL,' . $id . ',id,company_id,' . $company_id . ',deleted_at,NULL',
'invoiced_at' => 'required|date',
'due_at' => 'required|date',
'currency_code' => 'required|string',
'attachment' => 'mimes:' . setting('general.file_types') . '|between:0,' . setting('general.file_size') * 1024,
];
}
}

View File

@ -0,0 +1,35 @@
<?php
namespace App\Http\Requests\Income;
use App\Http\Requests\Request;
class InvoicePayment extends Request
{
/**
* 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()
{
return [
'account_id' => 'required|integer',
'paid_at' => 'required|date',
'amount' => 'required',
'currency_code' => 'required|string',
'payment_method' => 'required|string',
'attachment' => 'mimes:jpeg,jpg,png,pdf',
];
}
}

View File

@ -0,0 +1,36 @@
<?php
namespace App\Http\Requests\Income;
use App\Http\Requests\Request;
class Revenue extends Request
{
/**
* 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()
{
return [
'account_id' => 'required|integer',
'paid_at' => 'required|date',
'amount' => 'required',
'currency_code' => 'required|string',
'category_id' => 'required|integer',
'payment_method' => 'required|string',
'attachment' => 'mimes:' . setting('general.file_types') . '|between:0,' . setting('general.file_size') * 1024,
];
}
}