1
0
mirror of https://github.com/invoiceninja/invoiceninja.git synced 2024-11-10 05:02:36 +01:00

Add .env var for extensions

This commit is contained in:
David Bomba 2024-03-19 10:46:57 +11:00
parent 136c076623
commit 08eb30785d
46 changed files with 188 additions and 177 deletions

View File

@ -33,15 +33,15 @@ class UploadBankIntegrationRequest extends Request
$rules = [];
if ($this->file('documents') && is_array($this->file('documents'))) {
$rules['documents.*'] = $this->file_validation;
$rules['documents.*'] = $this->fileValidation();
} elseif ($this->file('documents')) {
$rules['documents'] = $this->file_validation;
$rules['documents'] = $this->fileValidation();
}
if ($this->file('file') && is_array($this->file('file'))) {
$rules['file.*'] = $this->file_validation;
$rules['file.*'] = $this->fileValidation();
} elseif ($this->file('file')) {
$rules['file'] = $this->file_validation;
$rules['file'] = $this->fileValidation();
}
$rules['is_public'] = 'sometimes|boolean';

View File

@ -33,15 +33,15 @@ class UploadBankTransactionRequest extends Request
$rules = [];
if ($this->file('documents') && is_array($this->file('documents'))) {
$rules['documents.*'] = $this->file_validation;
$rules['documents.*'] = $this->fileValidation();
} elseif ($this->file('documents')) {
$rules['documents'] = $this->file_validation;
$rules['documents'] = $this->fileValidation();
}
if ($this->file('file') && is_array($this->file('file'))) {
$rules['file.*'] = $this->file_validation;
$rules['file.*'] = $this->fileValidation();
} elseif ($this->file('file')) {
$rules['file'] = $this->file_validation;
$rules['file'] = $this->fileValidation();
}
$rules['is_public'] = 'sometimes|boolean';

View File

@ -45,18 +45,18 @@ class StoreClientRequest extends Request
$user = auth()->user();
if ($this->file('documents') && is_array($this->file('documents'))) {
$rules['documents.*'] = $this->file_validation;
$rules['documents.*'] = $this->fileValidation();
} elseif ($this->file('documents')) {
$rules['documents'] = $this->file_validation;
$rules['documents'] = $this->fileValidation();
}
else {
$rules['documents'] = 'bail|sometimes|array';
}
if ($this->file('file') && is_array($this->file('file'))) {
$rules['file.*'] = $this->file_validation;
$rules['file.*'] = $this->fileValidation();
} elseif ($this->file('file')) {
$rules['file'] = $this->file_validation;
$rules['file'] = $this->fileValidation();
}
/* Ensure we have a client name, and that all emails are unique*/

View File

@ -44,15 +44,15 @@ class UpdateClientRequest extends Request
$user = auth()->user();
if ($this->file('documents') && is_array($this->file('documents'))) {
$rules['documents.*'] = $this->file_validation;
$rules['documents.*'] = $this->fileValidation();
} elseif ($this->file('documents')) {
$rules['documents'] = $this->file_validation;
$rules['documents'] = $this->fileValidation();
}
if ($this->file('file') && is_array($this->file('file'))) {
$rules['file.*'] = $this->file_validation;
$rules['file.*'] = $this->fileValidation();
} elseif ($this->file('file')) {
$rules['file'] = $this->file_validation;
$rules['file'] = $this->fileValidation();
} else {
$rules['documents'] = 'bail|sometimes|array';
}

View File

@ -33,15 +33,15 @@ class UploadClientRequest extends Request
$rules = [];
if ($this->file('documents') && is_array($this->file('documents'))) {
$rules['documents.*'] = $this->file_validation;
$rules['documents.*'] = $this->fileValidation();
} elseif ($this->file('documents')) {
$rules['documents'] = $this->file_validation;
$rules['documents'] = $this->fileValidation();
}
if ($this->file('file') && is_array($this->file('file'))) {
$rules['file.*'] = $this->file_validation;
$rules['file.*'] = $this->fileValidation();
} elseif ($this->file('file')) {
$rules['file'] = $this->file_validation;
$rules['file'] = $this->fileValidation();
}
$rules['is_public'] = 'sometimes|boolean';

View File

@ -30,15 +30,15 @@ class UploadCompanyRequest extends Request
$rules = [];
if ($this->file('documents') && is_array($this->file('documents'))) {
$rules['documents.*'] = $this->file_validation;
$rules['documents.*'] = $this->fileValidation();
} elseif ($this->file('documents')) {
$rules['documents'] = $this->file_validation;
$rules['documents'] = $this->fileValidation();
}
if ($this->file('file') && is_array($this->file('file'))) {
$rules['file.*'] = $this->file_validation;
$rules['file.*'] = $this->fileValidation();
} elseif ($this->file('file')) {
$rules['file'] = $this->file_validation;
$rules['file'] = $this->fileValidation();
}
return $rules;

View File

@ -47,17 +47,17 @@ class StoreCreditRequest extends Request
$rules = [];
if ($this->file('documents') && is_array($this->file('documents'))) {
$rules['documents.*'] = $this->file_validation;
$rules['documents.*'] = $this->fileValidation();
} elseif ($this->file('documents')) {
$rules['documents'] = $this->file_validation;
$rules['documents'] = $this->fileValidation();
}else {
$rules['documents'] = 'bail|sometimes|array';
}
if ($this->file('file') && is_array($this->file('file'))) {
$rules['file.*'] = $this->file_validation;
$rules['file.*'] = $this->fileValidation();
} elseif ($this->file('file')) {
$rules['file'] = $this->file_validation;
$rules['file'] = $this->fileValidation();
}
/** @var \App\Models\User $user */

View File

@ -49,17 +49,17 @@ class UpdateCreditRequest extends Request
$rules = [];
if ($this->file('documents') && is_array($this->file('documents'))) {
$rules['documents.*'] = $this->file_validation;
$rules['documents.*'] = $this->fileValidation();
} elseif ($this->file('documents')) {
$rules['documents'] = $this->file_validation;
$rules['documents'] = $this->fileValidation();
}else {
$rules['documents'] = 'bail|sometimes|array';
}
if ($this->file('file') && is_array($this->file('file'))) {
$rules['file.*'] = $this->file_validation;
$rules['file.*'] = $this->fileValidation();
} elseif ($this->file('file')) {
$rules['file'] = $this->file_validation;
$rules['file'] = $this->fileValidation();
}
$rules['number'] = ['bail', 'sometimes', 'nullable', Rule::unique('credits')->where('company_id', $user->company()->id)->ignore($this->credit->id)];

View File

@ -33,15 +33,15 @@ class UploadCreditRequest extends Request
$rules = [];
if ($this->file('documents') && is_array($this->file('documents'))) {
$rules['documents.*'] = $this->file_validation;
$rules['documents.*'] = $this->fileValidation();
} elseif ($this->file('documents')) {
$rules['documents'] = $this->file_validation;
$rules['documents'] = $this->fileValidation();
}
if ($this->file('file') && is_array($this->file('file'))) {
$rules['file.*'] = $this->file_validation;
$rules['file.*'] = $this->fileValidation();
} elseif ($this->file('file')) {
$rules['file'] = $this->file_validation;
$rules['file'] = $this->fileValidation();
}
$rules['is_public'] = 'sometimes|boolean';

View File

@ -33,15 +33,15 @@ class UploadExpenseRequest extends Request
$rules = [];
if ($this->file('documents') && is_array($this->file('documents'))) {
$rules['documents.*'] = $this->file_validation;
$rules['documents.*'] = $this->fileValidation();
} elseif ($this->file('documents')) {
$rules['documents'] = $this->file_validation;
$rules['documents'] = $this->fileValidation();
}
if ($this->file('file') && is_array($this->file('file'))) {
$rules['file.*'] = $this->file_validation;
$rules['file.*'] = $this->fileValidation();
} elseif ($this->file('file')) {
$rules['file'] = $this->file_validation;
$rules['file'] = $this->fileValidation();
}
$rules['is_public'] = 'sometimes|boolean';

View File

@ -30,15 +30,15 @@ class UploadGroupSettingRequest extends Request
$rules = [];
if ($this->file('documents') && is_array($this->file('documents'))) {
$rules['documents.*'] = $this->file_validation;
$rules['documents.*'] = $this->fileValidation();
} elseif ($this->file('documents')) {
$rules['documents'] = $this->file_validation;
$rules['documents'] = $this->fileValidation();
}
if ($this->file('file') && is_array($this->file('file'))) {
$rules['file.*'] = $this->file_validation;
$rules['file.*'] = $this->fileValidation();
} elseif ($this->file('file')) {
$rules['file'] = $this->file_validation;
$rules['file'] = $this->fileValidation();
}
return $rules;

View File

@ -44,17 +44,17 @@ class StoreInvoiceRequest extends Request
$user = auth()->user();
if ($this->file('documents') && is_array($this->file('documents'))) {
$rules['documents.*'] = $this->file_validation;
$rules['documents.*'] = $this->fileValidation();
} elseif ($this->file('documents')) {
$rules['documents'] = $this->file_validation;
$rules['documents'] = $this->fileValidation();
}else {
$rules['documents'] = 'bail|sometimes|array';
}
if ($this->file('file') && is_array($this->file('file'))) {
$rules['file.*'] = $this->file_validation;
$rules['file.*'] = $this->fileValidation();
} elseif ($this->file('file')) {
$rules['file'] = $this->file_validation;
$rules['file'] = $this->fileValidation();
}
$rules['client_id'] = 'bail|required|exists:clients,id,company_id,'.$user->company()->id.',is_deleted,0';

View File

@ -46,17 +46,17 @@ class UpdateInvoiceRequest extends Request
$rules = [];
if ($this->file('documents') && is_array($this->file('documents'))) {
$rules['documents.*'] = $this->file_validation;
$rules['documents.*'] = $this->fileValidation();
} elseif ($this->file('documents')) {
$rules['documents'] = $this->file_validation;
$rules['documents'] = $this->fileValidation();
}else {
$rules['documents'] = 'bail|sometimes|array';
}
if ($this->file('file') && is_array($this->file('file'))) {
$rules['file.*'] = $this->file_validation;
$rules['file.*'] = $this->fileValidation();
} elseif ($this->file('file')) {
$rules['file'] = $this->file_validation;
$rules['file'] = $this->fileValidation();
}
// $rules['id'] = new LockedInvoiceRule($this->invoice);

View File

@ -33,15 +33,15 @@ class UploadInvoiceRequest extends Request
$rules = [];
if ($this->file('documents') && is_array($this->file('documents'))) {
$rules['documents.*'] = $this->file_validation;
$rules['documents.*'] = $this->fileValidation();
} elseif ($this->file('documents')) {
$rules['documents'] = $this->file_validation;
$rules['documents'] = $this->fileValidation();
}
if ($this->file('file') && is_array($this->file('file'))) {
$rules['file.*'] = $this->file_validation;
$rules['file.*'] = $this->fileValidation();
} elseif ($this->file('file')) {
$rules['file'] = $this->file_validation;
$rules['file'] = $this->fileValidation();
}
$rules['is_public'] = 'sometimes|boolean';

View File

@ -123,17 +123,17 @@ class StorePaymentRequest extends Request
];
if ($this->file('documents') && is_array($this->file('documents'))) {
$rules['documents.*'] = $this->file_validation;
$rules['documents.*'] = $this->fileValidation();
} elseif ($this->file('documents')) {
$rules['documents'] = $this->file_validation;
$rules['documents'] = $this->fileValidation();
}else {
$rules['documents'] = 'bail|sometimes|array';
}
if ($this->file('file') && is_array($this->file('file'))) {
$rules['file.*'] = $this->file_validation;
$rules['file.*'] = $this->fileValidation();
} elseif ($this->file('file')) {
$rules['file'] = $this->file_validation;
$rules['file'] = $this->fileValidation();
}
return $rules;

View File

@ -52,17 +52,17 @@ class UpdatePaymentRequest extends Request
}
if ($this->file('documents') && is_array($this->file('documents'))) {
$rules['documents.*'] = $this->file_validation;
$rules['documents.*'] = $this->fileValidation();
} elseif ($this->file('documents')) {
$rules['documents'] = $this->file_validation;
$rules['documents'] = $this->fileValidation();
}else {
$rules['documents'] = 'bail|sometimes|array';
}
if ($this->file('file') && is_array($this->file('file'))) {
$rules['file.*'] = $this->file_validation;
$rules['file.*'] = $this->fileValidation();
} elseif ($this->file('file')) {
$rules['file'] = $this->file_validation;
$rules['file'] = $this->fileValidation();
}
return $rules;

View File

@ -33,15 +33,15 @@ class UploadPaymentRequest extends Request
$rules = [];
if ($this->file('documents') && is_array($this->file('documents'))) {
$rules['documents.*'] = $this->file_validation;
$rules['documents.*'] = $this->fileValidation();
} elseif ($this->file('documents')) {
$rules['documents'] = $this->file_validation;
$rules['documents'] = $this->fileValidation();
}
if ($this->file('file') && is_array($this->file('file'))) {
$rules['file.*'] = $this->file_validation;
$rules['file.*'] = $this->fileValidation();
} elseif ($this->file('file')) {
$rules['file'] = $this->file_validation;
$rules['file'] = $this->fileValidation();
}
$rules['is_public'] = 'sometimes|boolean';

View File

@ -32,17 +32,17 @@ class StoreProductRequest extends Request
public function rules()
{
if ($this->file('documents') && is_array($this->file('documents'))) {
$rules['documents.*'] = $this->file_validation;
$rules['documents.*'] = $this->fileValidation();
} elseif ($this->file('documents')) {
$rules['documents'] = $this->file_validation;
$rules['documents'] = $this->fileValidation();
}else {
$rules['documents'] = 'bail|sometimes|array';
}
if ($this->file('file') && is_array($this->file('file'))) {
$rules['file.*'] = $this->file_validation;
$rules['file.*'] = $this->fileValidation();
} elseif ($this->file('file')) {
$rules['file'] = $this->file_validation;
$rules['file'] = $this->fileValidation();
}
$rules['cost'] = 'sometimes|numeric';

View File

@ -35,17 +35,17 @@ class UpdateProductRequest extends Request
public function rules()
{
if ($this->file('documents') && is_array($this->file('documents'))) {
$rules['documents.*'] = $this->file_validation;
$rules['documents.*'] = $this->fileValidation();
} elseif ($this->file('documents')) {
$rules['documents'] = $this->file_validation;
$rules['documents'] = $this->fileValidation();
}else {
$rules['documents'] = 'bail|sometimes|array';
}
if ($this->file('file') && is_array($this->file('file'))) {
$rules['file.*'] = $this->file_validation;
$rules['file.*'] = $this->fileValidation();
} elseif ($this->file('file')) {
$rules['file'] = $this->file_validation;
$rules['file'] = $this->fileValidation();
}
$rules['cost'] = 'numeric';

View File

@ -32,15 +32,15 @@ class UploadProductRequest extends Request
{
$rules = [];
if ($this->file('documents') && is_array($this->file('documents'))) {
$rules['documents.*'] = $this->file_validation;
$rules['documents.*'] = $this->fileValidation();
} elseif ($this->file('documents')) {
$rules['documents'] = $this->file_validation;
$rules['documents'] = $this->fileValidation();
}
if ($this->file('file') && is_array($this->file('file'))) {
$rules['file.*'] = $this->file_validation;
$rules['file.*'] = $this->fileValidation();
} elseif ($this->file('file')) {
$rules['file'] = $this->file_validation;
$rules['file'] = $this->fileValidation();
}
$rules['is_public'] = 'sometimes|boolean';

View File

@ -51,17 +51,17 @@ class StoreProjectRequest extends Request
}
if ($this->file('documents') && is_array($this->file('documents'))) {
$rules['documents.*'] = $this->file_validation;
$rules['documents.*'] = $this->fileValidation();
} elseif ($this->file('documents')) {
$rules['documents'] = $this->file_validation;
$rules['documents'] = $this->fileValidation();
}else {
$rules['documents'] = 'bail|sometimes|array';
}
if ($this->file('file') && is_array($this->file('file'))) {
$rules['file.*'] = $this->file_validation;
$rules['file.*'] = $this->fileValidation();
} elseif ($this->file('file')) {
$rules['file'] = $this->file_validation;
$rules['file'] = $this->fileValidation();
}
return $this->globalRules($rules);

View File

@ -48,17 +48,17 @@ class UpdateProjectRequest extends Request
$rules['budgeted_hours'] = 'sometimes|numeric';
if ($this->file('documents') && is_array($this->file('documents'))) {
$rules['documents.*'] = $this->file_validation;
$rules['documents.*'] = $this->fileValidation();
} elseif ($this->file('documents')) {
$rules['documents'] = $this->file_validation;
$rules['documents'] = $this->fileValidation();
}else {
$rules['documents'] = 'bail|sometimes|array';
}
if ($this->file('file') && is_array($this->file('file'))) {
$rules['file.*'] = $this->file_validation;
$rules['file.*'] = $this->fileValidation();
} elseif ($this->file('file')) {
$rules['file'] = $this->file_validation;
$rules['file'] = $this->fileValidation();
}
return $this->globalRules($rules);

View File

@ -33,15 +33,15 @@ class UploadProjectRequest extends Request
$rules = [];
if ($this->file('documents') && is_array($this->file('documents'))) {
$rules['documents.*'] = $this->file_validation;
$rules['documents.*'] = $this->fileValidation();
} elseif ($this->file('documents')) {
$rules['documents'] = $this->file_validation;
$rules['documents'] = $this->fileValidation();
}
if ($this->file('file') && is_array($this->file('file'))) {
$rules['file.*'] = $this->file_validation;
$rules['file.*'] = $this->fileValidation();
} elseif ($this->file('file')) {
$rules['file'] = $this->file_validation;
$rules['file'] = $this->fileValidation();
}
$rules['is_public'] = 'sometimes|boolean';

View File

@ -54,17 +54,17 @@ class StorePurchaseOrderRequest extends Request
$rules['line_items'] = 'array';
if ($this->file('documents') && is_array($this->file('documents'))) {
$rules['documents.*'] = $this->file_validation;
$rules['documents.*'] = $this->fileValidation();
} elseif ($this->file('documents')) {
$rules['documents'] = $this->file_validation;
$rules['documents'] = $this->fileValidation();
} else {
$rules['documents'] = 'bail|sometimes|array';
}
if ($this->file('file') && is_array($this->file('file'))) {
$rules['file.*'] = $this->file_validation;
$rules['file.*'] = $this->fileValidation();
} elseif ($this->file('file')) {
$rules['file'] = $this->file_validation;
$rules['file'] = $this->fileValidation();
}
$rules['status_id'] = 'nullable|integer|in:1,2,3,4,5';

View File

@ -56,17 +56,17 @@ class UpdatePurchaseOrderRequest extends Request
$rules['is_amount_discount'] = ['boolean'];
if ($this->file('documents') && is_array($this->file('documents'))) {
$rules['documents.*'] = $this->file_validation;
$rules['documents.*'] = $this->fileValidation();
} elseif ($this->file('documents')) {
$rules['documents'] = $this->file_validation;
$rules['documents'] = $this->fileValidation();
}else {
$rules['documents'] = 'bail|sometimes|array';
}
if ($this->file('file') && is_array($this->file('file'))) {
$rules['file.*'] = $this->file_validation;
$rules['file.*'] = $this->fileValidation();
} elseif ($this->file('file')) {
$rules['file'] = $this->file_validation;
$rules['file'] = $this->fileValidation();
}
$rules['status_id'] = 'sometimes|integer|in:1,2,3,4,5';

View File

@ -33,15 +33,15 @@ class UploadPurchaseOrderRequest extends Request
$rules = [];
if ($this->file('documents') && is_array($this->file('documents'))) {
$rules['documents.*'] = $this->file_validation;
$rules['documents.*'] = $this->fileValidation();
} elseif ($this->file('documents')) {
$rules['documents'] = $this->file_validation;
$rules['documents'] = $this->fileValidation();
}
if ($this->file('file') && is_array($this->file('file'))) {
$rules['file.*'] = $this->file_validation;
$rules['file.*'] = $this->fileValidation();
} elseif ($this->file('file')) {
$rules['file'] = $this->file_validation;
$rules['file'] = $this->fileValidation();
}
$rules['is_public'] = 'sometimes|boolean';

View File

@ -46,17 +46,17 @@ class StoreQuoteRequest extends Request
$rules['client_id'] = 'required|exists:clients,id,company_id,'.$user->company()->id;
if ($this->file('documents') && is_array($this->file('documents'))) {
$rules['documents.*'] = $this->file_validation;
$rules['documents.*'] = $this->fileValidation();
} elseif ($this->file('documents')) {
$rules['documents'] = $this->file_validation;
$rules['documents'] = $this->fileValidation();
}else {
$rules['documents'] = 'bail|sometimes|array';
}
if ($this->file('file') && is_array($this->file('file'))) {
$rules['file.*'] = $this->file_validation;
$rules['file.*'] = $this->fileValidation();
} elseif ($this->file('file')) {
$rules['file'] = $this->file_validation;
$rules['file'] = $this->fileValidation();
}
$rules['number'] = ['nullable', Rule::unique('quotes')->where('company_id', $user->company()->id)];

View File

@ -43,17 +43,17 @@ class UpdateQuoteRequest extends Request
$rules = [];
if ($this->file('documents') && is_array($this->file('documents'))) {
$rules['documents.*'] = $this->file_validation;
$rules['documents.*'] = $this->fileValidation();
} elseif ($this->file('documents')) {
$rules['documents'] = $this->file_validation;
$rules['documents'] = $this->fileValidation();
}else {
$rules['documents'] = 'bail|sometimes|array';
}
if ($this->file('file') && is_array($this->file('file'))) {
$rules['file.*'] = $this->file_validation;
$rules['file.*'] = $this->fileValidation();
} elseif ($this->file('file')) {
$rules['file'] = $this->file_validation;
$rules['file'] = $this->fileValidation();
}

View File

@ -33,15 +33,15 @@ class UploadQuoteRequest extends Request
$rules = [];
if ($this->file('documents') && is_array($this->file('documents'))) {
$rules['documents.*'] = $this->file_validation;
$rules['documents.*'] = $this->fileValidation();
} elseif ($this->file('documents')) {
$rules['documents'] = $this->file_validation;
$rules['documents'] = $this->fileValidation();
}
if ($this->file('file') && is_array($this->file('file'))) {
$rules['file.*'] = $this->file_validation;
$rules['file.*'] = $this->fileValidation();
} elseif ($this->file('file')) {
$rules['file'] = $this->file_validation;
$rules['file'] = $this->fileValidation();
}
$rules['is_public'] = 'sometimes|boolean';

View File

@ -57,15 +57,15 @@ class StoreRecurringExpenseRequest extends Request
$rules['currency_id'] = 'bail|required|integer|exists:currencies,id';
if ($this->file('documents') && is_array($this->file('documents'))) {
$rules['documents.*'] = $this->file_validation;
$rules['documents.*'] = $this->fileValidation();
} elseif ($this->file('documents')) {
$rules['documents'] = $this->file_validation;
$rules['documents'] = $this->fileValidation();
}
if ($this->file('file') && is_array($this->file('file'))) {
$rules['file.*'] = $this->file_validation;
$rules['file.*'] = $this->fileValidation();
} elseif ($this->file('file')) {
$rules['file'] = $this->file_validation;
$rules['file'] = $this->fileValidation();
}
return $this->globalRules($rules);

View File

@ -49,15 +49,15 @@ class UpdateRecurringExpenseRequest extends Request
$rules['category_id'] = 'bail|nullable|sometimes|exists:expense_categories,id,company_id,'.auth()->user()->company()->id.',is_deleted,0';
if ($this->file('documents') && is_array($this->file('documents'))) {
$rules['documents.*'] = $this->file_validation;
$rules['documents.*'] = $this->fileValidation();
} elseif ($this->file('documents')) {
$rules['documents'] = $this->file_validation;
$rules['documents'] = $this->fileValidation();
}
if ($this->file('file') && is_array($this->file('file'))) {
$rules['file.*'] = $this->file_validation;
$rules['file.*'] = $this->fileValidation();
} elseif ($this->file('file')) {
$rules['file'] = $this->file_validation;
$rules['file'] = $this->fileValidation();
}
return $this->globalRules($rules);

View File

@ -30,15 +30,15 @@ class UploadRecurringExpenseRequest extends Request
$rules = [];
if ($this->file('documents') && is_array($this->file('documents'))) {
$rules['documents.*'] = $this->file_validation;
$rules['documents.*'] = $this->fileValidation();
} elseif ($this->file('documents')) {
$rules['documents'] = $this->file_validation;
$rules['documents'] = $this->fileValidation();
}
if ($this->file('file') && is_array($this->file('file'))) {
$rules['file.*'] = $this->file_validation;
$rules['file.*'] = $this->fileValidation();
} elseif ($this->file('file')) {
$rules['file'] = $this->file_validation;
$rules['file'] = $this->fileValidation();
}
return $rules;

View File

@ -46,17 +46,17 @@ class StoreRecurringInvoiceRequest extends Request
$rules = [];
if ($this->file('documents') && is_array($this->file('documents'))) {
$rules['documents.*'] = $this->file_validation;
$rules['documents.*'] = $this->fileValidation();
} elseif ($this->file('documents')) {
$rules['documents'] = $this->file_validation;
$rules['documents'] = $this->fileValidation();
}else {
$rules['documents'] = 'bail|sometimes|array';
}
if ($this->file('file') && is_array($this->file('file'))) {
$rules['file.*'] = $this->file_validation;
$rules['file.*'] = $this->fileValidation();
} elseif ($this->file('file')) {
$rules['file'] = $this->file_validation;
$rules['file'] = $this->fileValidation();
}
$rules['client_id'] = 'required|exists:clients,id,company_id,'.$user->company()->id;

View File

@ -45,17 +45,17 @@ class UpdateRecurringInvoiceRequest extends Request
$rules = [];
if ($this->file('documents') && is_array($this->file('documents'))) {
$rules['documents.*'] = $this->file_validation;
$rules['documents.*'] = $this->fileValidation();
} elseif ($this->file('documents')) {
$rules['documents'] = $this->file_validation;
$rules['documents'] = $this->fileValidation();
}else {
$rules['documents'] = 'bail|sometimes|array';
}
if ($this->file('file') && is_array($this->file('file'))) {
$rules['file.*'] = $this->file_validation;
$rules['file.*'] = $this->fileValidation();
} elseif ($this->file('file')) {
$rules['file'] = $this->file_validation;
$rules['file'] = $this->fileValidation();
}
$rules['number'] = ['bail', 'sometimes', Rule::unique('recurring_invoices')->where('company_id', $user->company()->id)->ignore($this->recurring_invoice->id)];

View File

@ -33,15 +33,15 @@ class UploadRecurringInvoiceRequest extends Request
$rules = [];
if ($this->file('documents') && is_array($this->file('documents'))) {
$rules['documents.*'] = $this->file_validation;
$rules['documents.*'] = $this->fileValidation();
} elseif ($this->file('documents')) {
$rules['documents'] = $this->file_validation;
$rules['documents'] = $this->fileValidation();
}
if ($this->file('file') && is_array($this->file('file'))) {
$rules['file.*'] = $this->file_validation;
$rules['file.*'] = $this->fileValidation();
} elseif ($this->file('file')) {
$rules['file'] = $this->file_validation;
$rules['file'] = $this->fileValidation();
}
$rules['is_public'] = 'sometimes|boolean';

View File

@ -46,15 +46,15 @@ class StoreRecurringQuoteRequest extends Request
$rules = [];
if ($this->file('documents') && is_array($this->file('documents'))) {
$rules['documents.*'] = $this->file_validation;
$rules['documents.*'] = $this->fileValidation();
} elseif ($this->file('documents')) {
$rules['documents'] = $this->file_validation;
$rules['documents'] = $this->fileValidation();
}
if ($this->file('file') && is_array($this->file('file'))) {
$rules['file.*'] = $this->file_validation;
$rules['file.*'] = $this->fileValidation();
} elseif ($this->file('file')) {
$rules['file'] = $this->file_validation;
$rules['file'] = $this->fileValidation();
}
$rules['client_id'] = 'required|exists:clients,id,company_id,'.$user->company()->id;

View File

@ -38,15 +38,15 @@ class UpdateRecurringQuoteRequest extends Request
$rules = [];
if ($this->file('documents') && is_array($this->file('documents'))) {
$rules['documents.*'] = $this->file_validation;
$rules['documents.*'] = $this->fileValidation();
} elseif ($this->file('documents')) {
$rules['documents'] = $this->file_validation;
$rules['documents'] = $this->fileValidation();
}
if ($this->file('file') && is_array($this->file('file'))) {
$rules['file.*'] = $this->file_validation;
$rules['file.*'] = $this->fileValidation();
} elseif ($this->file('file')) {
$rules['file'] = $this->file_validation;
$rules['file'] = $this->fileValidation();
}
if ($this->number) {

View File

@ -30,15 +30,15 @@ class UploadRecurringQuoteRequest extends Request
$rules = [];
if ($this->file('documents') && is_array($this->file('documents'))) {
$rules['documents.*'] = $this->file_validation;
$rules['documents.*'] = $this->fileValidation();
} elseif ($this->file('documents')) {
$rules['documents'] = $this->file_validation;
$rules['documents'] = $this->fileValidation();
}
if ($this->file('file') && is_array($this->file('file'))) {
$rules['file.*'] = $this->file_validation;
$rules['file.*'] = $this->fileValidation();
} elseif ($this->file('file')) {
$rules['file'] = $this->file_validation;
$rules['file'] = $this->fileValidation();
}
return $rules;

View File

@ -20,7 +20,7 @@ class Request extends FormRequest
use MakesHash;
use RuntimeFormRequest;
protected $file_validation = 'sometimes|file|mimes:png,ai,jpeg,tiff,pdf,gif,psd,txt,doc,xls,ppt,xlsx,docx,pptx,webp,xml,zip,csv,ods,odt,odp|max:100000';
protected $file_validation = 'sometimes|file|max:100000|mimes:png,ai,jpeg,tiff,pdf,gif,psd,txt,doc,xls,ppt,xlsx,docx,pptx,webp,xml,zip,csv,ods,odt,odp';
/**
* Get the validation rules that apply to the request.
*
@ -31,6 +31,15 @@ class Request extends FormRequest
return [];
}
public function fileValidation()
{
if(config('ninja.upload_extensions'))
return $this->file_validation. ",".config('ninja.upload_extensions');
return $this->file_validation;
}
public function globalRules($rules)
{
$merge_rules = [];

View File

@ -79,17 +79,17 @@ class StoreTaskRequest extends Request
}];
if ($this->file('documents') && is_array($this->file('documents'))) {
$rules['documents.*'] = $this->file_validation;
$rules['documents.*'] = $this->fileValidation();
} elseif ($this->file('documents')) {
$rules['documents'] = $this->file_validation;
$rules['documents'] = $this->fileValidation();
}else {
$rules['documents'] = 'bail|sometimes|array';
}
if ($this->file('file') && is_array($this->file('file'))) {
$rules['file.*'] = $this->file_validation;
$rules['file.*'] = $this->fileValidation();
} elseif ($this->file('file')) {
$rules['file'] = $this->file_validation;
$rules['file'] = $this->fileValidation();
}

View File

@ -85,17 +85,17 @@ class UpdateTaskRequest extends Request
}];
if ($this->file('documents') && is_array($this->file('documents'))) {
$rules['documents.*'] = $this->file_validation;
$rules['documents.*'] = $this->fileValidation();
} elseif ($this->file('documents')) {
$rules['documents'] = $this->file_validation;
$rules['documents'] = $this->fileValidation();
}else {
$rules['documents'] = 'bail|sometimes|array';
}
if ($this->file('file') && is_array($this->file('file'))) {
$rules['file.*'] = $this->file_validation;
$rules['file.*'] = $this->fileValidation();
} elseif ($this->file('file')) {
$rules['file'] = $this->file_validation;
$rules['file'] = $this->fileValidation();
}
return $this->globalRules($rules);

View File

@ -33,15 +33,15 @@ class UploadTaskRequest extends Request
$rules = [];
if ($this->file('documents') && is_array($this->file('documents'))) {
$rules['documents.*'] = $this->file_validation;
$rules['documents.*'] = $this->fileValidation();
} elseif ($this->file('documents')) {
$rules['documents'] = $this->file_validation;
$rules['documents'] = $this->fileValidation();
}
if ($this->file('file') && is_array($this->file('file'))) {
$rules['file.*'] = $this->file_validation;
$rules['file.*'] = $this->fileValidation();
} elseif ($this->file('file')) {
$rules['file'] = $this->file_validation;
$rules['file'] = $this->fileValidation();
}
$rules['is_public'] = 'sometimes|boolean';

View File

@ -61,17 +61,17 @@ class StoreVendorRequest extends Request
$rules['currency_id'] = 'bail|required|exists:currencies,id';
if ($this->file('documents') && is_array($this->file('documents'))) {
$rules['documents.*'] = $this->file_validation;
$rules['documents.*'] = $this->fileValidation();
} elseif ($this->file('documents')) {
$rules['documents'] = $this->file_validation;
$rules['documents'] = $this->fileValidation();
}else {
$rules['documents'] = 'bail|sometimes|array';
}
if ($this->file('file') && is_array($this->file('file'))) {
$rules['file.*'] = $this->file_validation;
$rules['file.*'] = $this->fileValidation();
} elseif ($this->file('file')) {
$rules['file'] = $this->file_validation;
$rules['file'] = $this->fileValidation();
}
$rules['language_id'] = 'bail|nullable|sometimes|exists:languages,id';

View File

@ -62,17 +62,17 @@ class UpdateVendorRequest extends Request
$rules['currency_id'] = 'bail|sometimes|exists:currencies,id';
if ($this->file('documents') && is_array($this->file('documents'))) {
$rules['documents.*'] = $this->file_validation;
$rules['documents.*'] = $this->fileValidation();
} elseif ($this->file('documents')) {
$rules['documents'] = $this->file_validation;
$rules['documents'] = $this->fileValidation();
}else {
$rules['documents'] = 'bail|sometimes|array';
}
if ($this->file('file') && is_array($this->file('file'))) {
$rules['file.*'] = $this->file_validation;
$rules['file.*'] = $this->fileValidation();
} elseif ($this->file('file')) {
$rules['file'] = $this->file_validation;
$rules['file'] = $this->fileValidation();
}
$rules['language_id'] = 'bail|nullable|sometimes|exists:languages,id';

View File

@ -30,15 +30,15 @@ class UploadVendorRequest extends Request
$rules = [];
if ($this->file('documents') && is_array($this->file('documents'))) {
$rules['documents.*'] = $this->file_validation;
$rules['documents.*'] = $this->fileValidation();
} elseif ($this->file('documents')) {
$rules['documents'] = $this->file_validation;
$rules['documents'] = $this->fileValidation();
}
if ($this->file('file') && is_array($this->file('file'))) {
$rules['file.*'] = $this->file_validation;
$rules['file.*'] = $this->fileValidation();
} elseif ($this->file('file')) {
$rules['file'] = $this->file_validation;
$rules['file'] = $this->fileValidation();
}
$rules['is_public'] = 'sometimes|boolean';

View File

@ -244,4 +244,6 @@ return [
'public_key' => env('NINJA_PUBLIC_KEY', false),
'private_key' => env('NINJA_PRIVATE_KEY', false),
],
'upload_extensions' => env('ADDITIONAL_UPLOAD_EXTENSIONS', false),
];