first commit
This commit is contained in:
31
app/Http/Requests/Auth/Permission.php
Normal file
31
app/Http/Requests/Auth/Permission.php
Normal file
@ -0,0 +1,31 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Requests\Auth;
|
||||
|
||||
use Illuminate\Foundation\Http\FormRequest;
|
||||
|
||||
class Permission 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()
|
||||
{
|
||||
return [
|
||||
'name' => 'required|string',
|
||||
'display_name' => 'required|string',
|
||||
];
|
||||
}
|
||||
}
|
32
app/Http/Requests/Auth/Role.php
Normal file
32
app/Http/Requests/Auth/Role.php
Normal file
@ -0,0 +1,32 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Requests\Auth;
|
||||
|
||||
use Illuminate\Foundation\Http\FormRequest;
|
||||
|
||||
class Role 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()
|
||||
{
|
||||
return [
|
||||
'name' => 'required|string',
|
||||
'display_name' => 'required|string',
|
||||
'permissions' => 'required'
|
||||
];
|
||||
}
|
||||
}
|
43
app/Http/Requests/Auth/User.php
Normal file
43
app/Http/Requests/Auth/User.php
Normal file
@ -0,0 +1,43 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Requests\Auth;
|
||||
|
||||
use Illuminate\Foundation\Http\FormRequest;
|
||||
|
||||
class User 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()
|
||||
{
|
||||
// Check if store or update
|
||||
if ($this->getMethod() == 'PATCH') {
|
||||
$id = $this->user->getAttribute('id');
|
||||
$required = '';
|
||||
} else {
|
||||
$id = null;
|
||||
$required = 'required|';
|
||||
}
|
||||
|
||||
return [
|
||||
'name' => 'required|string',
|
||||
'email' => 'required|email|unique:users,email,' . $id . ',id,deleted_at,NULL',
|
||||
'password' => $required . 'confirmed',
|
||||
'roles' => 'required',
|
||||
'picture' => 'mimes:' . setting('general.file_types') . '|between:0,' . setting('general.file_size') * 1024,
|
||||
];
|
||||
}
|
||||
}
|
33
app/Http/Requests/Banking/Account.php
Normal file
33
app/Http/Requests/Banking/Account.php
Normal file
@ -0,0 +1,33 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Requests\Banking;
|
||||
|
||||
use App\Http\Requests\Request;
|
||||
|
||||
class Account 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 [
|
||||
'name' => 'required|string',
|
||||
'number' => 'required|string',
|
||||
'currency_code' => 'required|string',
|
||||
'opening_balance' => 'required',
|
||||
];
|
||||
}
|
||||
}
|
34
app/Http/Requests/Banking/Transfer.php
Normal file
34
app/Http/Requests/Banking/Transfer.php
Normal file
@ -0,0 +1,34 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Requests\Banking;
|
||||
|
||||
use App\Http\Requests\Request;
|
||||
|
||||
class Transfer 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 [
|
||||
'from_account_id' => 'required|integer',
|
||||
'to_account_id' => 'required|integer',
|
||||
'amount' => 'required',
|
||||
'transferred_at' => 'required|date',
|
||||
'payment_method' => 'required|string',
|
||||
];
|
||||
}
|
||||
}
|
34
app/Http/Requests/Company/Company.php
Normal file
34
app/Http/Requests/Company/Company.php
Normal file
@ -0,0 +1,34 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Requests\Company;
|
||||
|
||||
use Illuminate\Foundation\Http\FormRequest;
|
||||
|
||||
class Company 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()
|
||||
{
|
||||
return [
|
||||
'domain' => 'required|string',
|
||||
'company_name' => 'required|string',
|
||||
'company_email' => 'required|email',
|
||||
'company_logo' => 'mimes:' . setting('general.file_types') . '|between:0,' . setting('general.file_size') * 1024,
|
||||
'default_currency' => 'required|string',
|
||||
];
|
||||
}
|
||||
}
|
45
app/Http/Requests/Expense/Bill.php
Normal file
45
app/Http/Requests/Expense/Bill.php
Normal file
@ -0,0 +1,45 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Requests\Expense;
|
||||
|
||||
use App\Http\Requests\Request;
|
||||
|
||||
class Bill 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->bill->getAttribute('id');
|
||||
} else {
|
||||
$id = null;
|
||||
}
|
||||
|
||||
// Get company id
|
||||
$company_id = $this->request->get('company_id');
|
||||
|
||||
return [
|
||||
'vendor_id' => 'required|integer',
|
||||
'bill_number' => 'required|string|unique:bills,NULL,' . $id . ',id,company_id,' . $company_id . ',deleted_at,NULL',
|
||||
'billed_at' => 'required|date',
|
||||
'due_at' => 'required|date',
|
||||
'currency_code' => 'required|string',
|
||||
'attachment' => 'mimes:' . setting('general.file_types') . '|between:0,' . setting('general.file_size') * 1024,
|
||||
];
|
||||
}
|
||||
}
|
35
app/Http/Requests/Expense/BillPayment.php
Normal file
35
app/Http/Requests/Expense/BillPayment.php
Normal file
@ -0,0 +1,35 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Requests\Expense;
|
||||
|
||||
use App\Http\Requests\Request;
|
||||
|
||||
class BillPayment 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:' . setting('general.file_types', 'pdf,jpeg,jpg,png'),
|
||||
];
|
||||
}
|
||||
}
|
36
app/Http/Requests/Expense/Payment.php
Normal file
36
app/Http/Requests/Expense/Payment.php
Normal file
@ -0,0 +1,36 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Requests\Expense;
|
||||
|
||||
use App\Http\Requests\Request;
|
||||
|
||||
class Payment 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,
|
||||
];
|
||||
}
|
||||
}
|
42
app/Http/Requests/Expense/Vendor.php
Normal file
42
app/Http/Requests/Expense/Vendor.php
Normal file
@ -0,0 +1,42 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Requests\Expense;
|
||||
|
||||
use App\Http\Requests\Request;
|
||||
|
||||
class Vendor 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->vendor->getAttribute('id');
|
||||
} else {
|
||||
$id = null;
|
||||
}
|
||||
|
||||
// Get company id
|
||||
$company_id = $this->request->get('company_id');
|
||||
|
||||
return [
|
||||
'name' => 'required|string',
|
||||
'email' => 'required|email|unique:vendors,NULL,' . $id . ',id,company_id,' . $company_id . ',deleted_at,NULL',
|
||||
'currency_code' => 'required|string',
|
||||
];
|
||||
}
|
||||
}
|
49
app/Http/Requests/Income/Customer.php
Normal file
49
app/Http/Requests/Income/Customer.php
Normal 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',
|
||||
];
|
||||
}
|
||||
}
|
45
app/Http/Requests/Income/Invoice.php
Normal file
45
app/Http/Requests/Income/Invoice.php
Normal 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,
|
||||
];
|
||||
}
|
||||
}
|
35
app/Http/Requests/Income/InvoicePayment.php
Normal file
35
app/Http/Requests/Income/InvoicePayment.php
Normal 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',
|
||||
];
|
||||
}
|
||||
}
|
36
app/Http/Requests/Income/Revenue.php
Normal file
36
app/Http/Requests/Income/Revenue.php
Normal 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,
|
||||
];
|
||||
}
|
||||
}
|
32
app/Http/Requests/Install/Database.php
Normal file
32
app/Http/Requests/Install/Database.php
Normal file
@ -0,0 +1,32 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Requests\Install;
|
||||
|
||||
use App\Http\Requests\Request;
|
||||
|
||||
class Database 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 [
|
||||
'hostname' => 'required',
|
||||
'username' => 'required',
|
||||
'database' => 'required'
|
||||
];
|
||||
}
|
||||
}
|
33
app/Http/Requests/Install/Setting.php
Normal file
33
app/Http/Requests/Install/Setting.php
Normal file
@ -0,0 +1,33 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Requests\Install;
|
||||
|
||||
use App\Http\Requests\Request;
|
||||
|
||||
class Setting 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 [
|
||||
'company_name' => 'required',
|
||||
'company_email' => 'required',
|
||||
'user_email' => 'required',
|
||||
'user_password' => 'required'
|
||||
];
|
||||
}
|
||||
}
|
45
app/Http/Requests/Item/Item.php
Normal file
45
app/Http/Requests/Item/Item.php
Normal file
@ -0,0 +1,45 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Requests\Item;
|
||||
|
||||
use App\Http\Requests\Request;
|
||||
|
||||
class Item 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->item->getAttribute('id');
|
||||
} else {
|
||||
$id = null;
|
||||
}
|
||||
|
||||
// Get company id
|
||||
$company_id = $this->request->get('company_id');
|
||||
|
||||
return [
|
||||
'name' => 'required|string',
|
||||
'sku' => 'required|string|unique:items,NULL,' . $id . ',id,company_id,' . $company_id . ',deleted_at,NULL',
|
||||
'sale_price' => 'required',
|
||||
'purchase_price' => 'required',
|
||||
'quantity' => 'required|integer',
|
||||
'picture' => 'mimes:' . setting('general.file_types') . '|between:0,' . setting('general.file_size') * 1024,
|
||||
];
|
||||
}
|
||||
}
|
30
app/Http/Requests/Module/Module.php
Normal file
30
app/Http/Requests/Module/Module.php
Normal file
@ -0,0 +1,30 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Requests\Module;
|
||||
|
||||
use App\Http\Requests\Request;
|
||||
|
||||
class Module 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 [
|
||||
'api_token' => 'required|string',
|
||||
];
|
||||
}
|
||||
}
|
28
app/Http/Requests/Request.php
Normal file
28
app/Http/Requests/Request.php
Normal file
@ -0,0 +1,28 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Requests;
|
||||
|
||||
use Illuminate\Foundation\Http\FormRequest;
|
||||
|
||||
class Request extends FormRequest
|
||||
{
|
||||
|
||||
/**
|
||||
* Set the company id to the request.
|
||||
*
|
||||
* @return \Illuminate\Contracts\Validation\Validator
|
||||
*/
|
||||
protected function getValidatorInstance()
|
||||
{
|
||||
// Get request data
|
||||
$data = $this->all();
|
||||
|
||||
// Add active company id
|
||||
$data['company_id'] = session('company_id');
|
||||
|
||||
// Reset the request data
|
||||
$this->getInputSource()->replace($data);
|
||||
|
||||
return parent::getValidatorInstance();
|
||||
}
|
||||
}
|
32
app/Http/Requests/Setting/Category.php
Normal file
32
app/Http/Requests/Setting/Category.php
Normal file
@ -0,0 +1,32 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Requests\Setting;
|
||||
|
||||
use App\Http\Requests\Request;
|
||||
|
||||
class Category 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 [
|
||||
'name' => 'required|string',
|
||||
'type' => 'required|string',
|
||||
'color' => 'required|string',
|
||||
];
|
||||
}
|
||||
}
|
44
app/Http/Requests/Setting/Currency.php
Normal file
44
app/Http/Requests/Setting/Currency.php
Normal file
@ -0,0 +1,44 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Requests\Setting;
|
||||
|
||||
use App\Http\Requests\Request;
|
||||
|
||||
class Currency 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->currency->getAttribute('id');
|
||||
} else {
|
||||
$id = null;
|
||||
}
|
||||
|
||||
// Get company id
|
||||
$company_id = $this->request->get('company_id');
|
||||
|
||||
return [
|
||||
'name' => 'required|string',
|
||||
'code' => 'required|string|unique:currencies,NULL,' . $id . ',id,company_id,' . $company_id . ',deleted_at,NULL',
|
||||
'rate' => 'required',
|
||||
'enabled' => 'boolean',
|
||||
'default_currency' => 'boolean',
|
||||
];
|
||||
}
|
||||
}
|
32
app/Http/Requests/Setting/Setting.php
Normal file
32
app/Http/Requests/Setting/Setting.php
Normal file
@ -0,0 +1,32 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Requests\Setting;
|
||||
|
||||
use App\Http\Requests\Request;
|
||||
|
||||
class Setting 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 [
|
||||
'company_name' => 'required|string',
|
||||
'company_email' => 'required|email',
|
||||
'company_logo' => 'mimes:' . setting('general.file_types', 'pdf,jpeg,jpg,png'),
|
||||
];
|
||||
}
|
||||
}
|
31
app/Http/Requests/Setting/Tax.php
Normal file
31
app/Http/Requests/Setting/Tax.php
Normal file
@ -0,0 +1,31 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Requests\Setting;
|
||||
|
||||
use App\Http\Requests\Request;
|
||||
|
||||
class Tax 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 [
|
||||
'name' => 'required|string',
|
||||
'rate' => 'required',
|
||||
];
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user