mirror of
https://github.com/crater-invoice/crater.git
synced 2025-12-15 01:42:54 -05:00
init crater
This commit is contained in:
30
app/Http/Requests/CompanyRequest.php
Normal file
30
app/Http/Requests/CompanyRequest.php
Normal file
@@ -0,0 +1,30 @@
|
||||
<?php
|
||||
namespace Laraspace\Http\Requests;
|
||||
|
||||
use Illuminate\Foundation\Http\FormRequest;
|
||||
|
||||
class CompanyRequest 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',
|
||||
'country_id' => 'required'
|
||||
];
|
||||
}
|
||||
}
|
||||
34
app/Http/Requests/CompanySettingRequest.php
Normal file
34
app/Http/Requests/CompanySettingRequest.php
Normal file
@@ -0,0 +1,34 @@
|
||||
<?php
|
||||
namespace Laraspace\Http\Requests;
|
||||
|
||||
use Illuminate\Foundation\Http\FormRequest;
|
||||
|
||||
class CompanySettingRequest 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 [
|
||||
'currency' => 'required',
|
||||
'time_zone' => 'required',
|
||||
'language' => 'required',
|
||||
'fiscal_year' => 'required',
|
||||
'moment_date_format' => 'required',
|
||||
'carbon_date_format' => 'required',
|
||||
];
|
||||
}
|
||||
}
|
||||
41
app/Http/Requests/CustomerRequest.php
Normal file
41
app/Http/Requests/CustomerRequest.php
Normal file
@@ -0,0 +1,41 @@
|
||||
<?php
|
||||
namespace Laraspace\Http\Requests;
|
||||
|
||||
use Illuminate\Foundation\Http\FormRequest;
|
||||
|
||||
class CustomerRequest 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()
|
||||
{
|
||||
switch ($this->getMethod()) {
|
||||
case 'POST':
|
||||
return [
|
||||
'name' => 'required',
|
||||
'email' => 'email|nullable|unique:users,email',
|
||||
];
|
||||
break;
|
||||
case 'PUT':
|
||||
return [
|
||||
'name' => 'required',
|
||||
];
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
35
app/Http/Requests/DatabaseEnvironmentRequest.php
Normal file
35
app/Http/Requests/DatabaseEnvironmentRequest.php
Normal file
@@ -0,0 +1,35 @@
|
||||
<?php
|
||||
|
||||
namespace Laraspace\Http\Requests;
|
||||
|
||||
use Illuminate\Foundation\Http\FormRequest;
|
||||
|
||||
class DatabaseEnvironmentRequest 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 [
|
||||
'app_url' => 'required|url',
|
||||
'database_connection' => 'required|string|max:50',
|
||||
'database_hostname' => 'required|string|max:50',
|
||||
'database_port' => 'required|numeric',
|
||||
'database_name' => 'required|string|max:50',
|
||||
'database_username' => 'required|string|max:50',
|
||||
];
|
||||
}
|
||||
}
|
||||
45
app/Http/Requests/EstimatesRequest.php
Normal file
45
app/Http/Requests/EstimatesRequest.php
Normal file
@@ -0,0 +1,45 @@
|
||||
<?php
|
||||
namespace Laraspace\Http\Requests;
|
||||
|
||||
use Illuminate\Foundation\Http\FormRequest;
|
||||
|
||||
class EstimatesRequest 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 = [
|
||||
'estimate_date' => 'required',
|
||||
'expiry_date' => 'required',
|
||||
'estimate_number' => 'required|unique:estimates,estimate_number',
|
||||
'user_id' => 'required',
|
||||
'discount' => 'required',
|
||||
'estimate_template_id' => 'required',
|
||||
'items' => 'required|array',
|
||||
'items.*' => 'required|max:255',
|
||||
'items.*.name' => 'required',
|
||||
'items.*.quantity' => 'required|numeric',
|
||||
'items.*.price' => 'required|numeric',
|
||||
];
|
||||
|
||||
if ($this->getMethod() == 'PUT') {
|
||||
$rules['estimate_number'] = $rules['estimate_number'].','.$this->get('id');
|
||||
}
|
||||
|
||||
return $rules;
|
||||
}
|
||||
}
|
||||
29
app/Http/Requests/ExpenseCategoryRequest.php
Normal file
29
app/Http/Requests/ExpenseCategoryRequest.php
Normal file
@@ -0,0 +1,29 @@
|
||||
<?php
|
||||
namespace Laraspace\Http\Requests;
|
||||
|
||||
use Illuminate\Foundation\Http\FormRequest;
|
||||
|
||||
class ExpenseCategoryRequest 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'
|
||||
];
|
||||
}
|
||||
}
|
||||
31
app/Http/Requests/ExpenseRequest.php
Normal file
31
app/Http/Requests/ExpenseRequest.php
Normal file
@@ -0,0 +1,31 @@
|
||||
<?php
|
||||
namespace Laraspace\Http\Requests;
|
||||
|
||||
use Illuminate\Foundation\Http\FormRequest;
|
||||
|
||||
class ExpenseRequest 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 [
|
||||
'expense_date' => 'required',
|
||||
'expense_category_id' => 'required',
|
||||
'amount' => 'required'
|
||||
];
|
||||
}
|
||||
}
|
||||
45
app/Http/Requests/InvoicesRequest.php
Normal file
45
app/Http/Requests/InvoicesRequest.php
Normal file
@@ -0,0 +1,45 @@
|
||||
<?php
|
||||
namespace Laraspace\Http\Requests;
|
||||
|
||||
use Illuminate\Foundation\Http\FormRequest;
|
||||
|
||||
class InvoicesRequest 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.s
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public function rules()
|
||||
{
|
||||
$rules = [
|
||||
'invoice_date' => 'required',
|
||||
'due_date' => 'required',
|
||||
'invoice_number' => 'required|unique:invoices,invoice_number',
|
||||
'user_id' => 'required',
|
||||
'discount' => 'required',
|
||||
'invoice_template_id' => 'required',
|
||||
'items' => 'required|array',
|
||||
'items.*' => 'required|max:255',
|
||||
'items.*.name' => 'required',
|
||||
'items.*.quantity' => 'required|numeric',
|
||||
'items.*.price' => 'required|numeric',
|
||||
];
|
||||
|
||||
if ($this->getMethod() == 'PUT') {
|
||||
$rules['invoice_number'] = $rules['invoice_number'].','.$this->get('id');
|
||||
}
|
||||
|
||||
return $rules;
|
||||
}
|
||||
}
|
||||
30
app/Http/Requests/ItemsRequest.php
Normal file
30
app/Http/Requests/ItemsRequest.php
Normal file
@@ -0,0 +1,30 @@
|
||||
<?php
|
||||
namespace Laraspace\Http\Requests;
|
||||
|
||||
use Illuminate\Foundation\Http\FormRequest;
|
||||
|
||||
class ItemsRequest 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',
|
||||
'price' => 'required',
|
||||
];
|
||||
}
|
||||
}
|
||||
35
app/Http/Requests/MailEnvironmentRequest.php
Normal file
35
app/Http/Requests/MailEnvironmentRequest.php
Normal file
@@ -0,0 +1,35 @@
|
||||
<?php
|
||||
|
||||
namespace Laraspace\Http\Requests;
|
||||
|
||||
use Illuminate\Foundation\Http\FormRequest;
|
||||
|
||||
class MailEnvironmentRequest 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 [
|
||||
'mail_driver' => 'required|string|max:50',
|
||||
'mail_host' => 'required|string|max:50',
|
||||
'mail_port' => 'required|max:50',
|
||||
'mail_username' => 'required|string|max:50',
|
||||
'mail_password' => 'required|string|max:50',
|
||||
'mail_encryption' => 'required|string|max:50',
|
||||
];
|
||||
}
|
||||
}
|
||||
38
app/Http/Requests/PaymentRequest.php
Normal file
38
app/Http/Requests/PaymentRequest.php
Normal file
@@ -0,0 +1,38 @@
|
||||
<?php
|
||||
namespace Laraspace\Http\Requests;
|
||||
|
||||
use Illuminate\Foundation\Http\FormRequest;
|
||||
|
||||
class PaymentRequest 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 = [
|
||||
'payment_date' => 'required',
|
||||
'payment_number' => 'required|unique:payments,payment_number',
|
||||
'user_id' => 'required',
|
||||
'amount' => 'required',
|
||||
];
|
||||
|
||||
if ($this->getMethod() == 'PUT') {
|
||||
$rules['payment_number'] = $rules['payment_number'].','.$this->route('payment');
|
||||
}
|
||||
|
||||
return $rules;
|
||||
}
|
||||
}
|
||||
51
app/Http/Requests/ProfileRequest.php
Normal file
51
app/Http/Requests/ProfileRequest.php
Normal file
@@ -0,0 +1,51 @@
|
||||
<?php
|
||||
namespace Laraspace\Http\Requests;
|
||||
|
||||
use Illuminate\Foundation\Http\FormRequest;
|
||||
use Illuminate\Validation\Rule;
|
||||
use Laraspace\User;
|
||||
|
||||
class ProfileRequest 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()
|
||||
{
|
||||
$user = User::find(1);
|
||||
|
||||
switch ($this->getMethod()) {
|
||||
case 'POST':
|
||||
return [
|
||||
'name' => 'required',
|
||||
'password' => 'required',
|
||||
'email' => [
|
||||
'required',
|
||||
'email',
|
||||
Rule::unique('users')->ignore($user->id, 'id')
|
||||
]
|
||||
];
|
||||
break;
|
||||
case 'PUT':
|
||||
return [
|
||||
'name' => 'required',
|
||||
'email' => 'required|email'
|
||||
];
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
9
app/Http/Requests/Request.php
Normal file
9
app/Http/Requests/Request.php
Normal file
@@ -0,0 +1,9 @@
|
||||
<?php
|
||||
namespace Laraspace\Http\Requests;
|
||||
|
||||
use Illuminate\Foundation\Http\FormRequest;
|
||||
|
||||
abstract class Request extends FormRequest
|
||||
{
|
||||
//
|
||||
}
|
||||
30
app/Http/Requests/SettingKeyRequest.php
Normal file
30
app/Http/Requests/SettingKeyRequest.php
Normal file
@@ -0,0 +1,30 @@
|
||||
<?php
|
||||
|
||||
namespace Laraspace\Http\Requests;
|
||||
|
||||
use Illuminate\Foundation\Http\FormRequest;
|
||||
|
||||
class SettingKeyRequest 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 [
|
||||
'key' => 'required'
|
||||
];
|
||||
}
|
||||
}
|
||||
31
app/Http/Requests/SettingRequest.php
Normal file
31
app/Http/Requests/SettingRequest.php
Normal file
@@ -0,0 +1,31 @@
|
||||
<?php
|
||||
|
||||
namespace Laraspace\Http\Requests;
|
||||
|
||||
use Illuminate\Foundation\Http\FormRequest;
|
||||
|
||||
class SettingRequest 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 [
|
||||
'key' => 'required',
|
||||
'value' => 'required'
|
||||
];
|
||||
}
|
||||
}
|
||||
30
app/Http/Requests/TaxTypeRequest.php
Normal file
30
app/Http/Requests/TaxTypeRequest.php
Normal file
@@ -0,0 +1,30 @@
|
||||
<?php
|
||||
namespace Laraspace\Http\Requests;
|
||||
|
||||
use Illuminate\Foundation\Http\FormRequest;
|
||||
|
||||
class TaxTypeRequest 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',
|
||||
'percent' => 'required'
|
||||
];
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user