diff --git a/app/Export/CSV/ProductSalesExport.php b/app/Export/CSV/ProductSalesExport.php index 72017220d501..2c9d17085293 100644 --- a/app/Export/CSV/ProductSalesExport.php +++ b/app/Export/CSV/ProductSalesExport.php @@ -85,7 +85,7 @@ class ProductSalesExport extends BaseExport $t = app('translator'); $t->replace(Ninja::transformTranslations($this->company->settings)); - $this->products = Product::where('company_id', $this->company->id)->withTrashed()->get(); + $this->products = Product::query()->where('company_id', $this->company->id)->withTrashed()->get(); //load the CSV document from a string $this->csv = Writer::createFromString(); diff --git a/app/Filters/QueryFilters.php b/app/Filters/QueryFilters.php index 1f8f1ce4208c..e58f88c8c388 100644 --- a/app/Filters/QueryFilters.php +++ b/app/Filters/QueryFilters.php @@ -72,8 +72,8 @@ abstract class QueryFilters /** * Apply the filters to the builder. * - * @param Builder $builder - * @return Builder + * @param \Illuminate\Database\Eloquent\Builder $builder + * @return \Illuminate\Database\Eloquent\Builder */ public function apply(Builder $builder) { @@ -239,7 +239,11 @@ abstract class QueryFilters } } - + /** + * + * @param string $value + * @return \Illuminate\Database\Eloquent\Builder + */ public function is_deleted($value = 'true') { if ($value == 'true') { diff --git a/app/Http/Controllers/PreviewPurchaseOrderController.php b/app/Http/Controllers/PreviewPurchaseOrderController.php index 6aac31cbac53..74b73b56183a 100644 --- a/app/Http/Controllers/PreviewPurchaseOrderController.php +++ b/app/Http/Controllers/PreviewPurchaseOrderController.php @@ -181,6 +181,7 @@ class PreviewPurchaseOrderController extends BaseController DB::connection(config('database.default'))->beginTransaction(); if ($request->has('entity_id')) { + /** @var \Illuminate\Database\Eloquent\Builder|\App\Models\PurchaseOrder $entity_obj|\Illuminate\Database\Eloquent\SoftDeletes */ $entity_obj = $class::on(config('database.default')) ->with('vendor.company') ->where('id', $this->decodePrimaryKey($request->input('entity_id'))) diff --git a/app/Http/Controllers/TaskController.php b/app/Http/Controllers/TaskController.php index 5deec8f6652b..c664a7a16829 100644 --- a/app/Http/Controllers/TaskController.php +++ b/app/Http/Controllers/TaskController.php @@ -327,8 +327,11 @@ class TaskController extends BaseController * ) */ public function create(CreateTaskRequest $request) - { - $task = TaskFactory::create(auth()->user()->company()->id, auth()->user()->id); + { + /** @var \App\Models\User $user */ + $user = auth()->user(); + + $task = TaskFactory::create($user->company()->id, $user->id); return $this->itemResponse($task); } @@ -373,10 +376,13 @@ class TaskController extends BaseController */ public function store(StoreTaskRequest $request) { - $task = $this->task_repo->save($request->all(), TaskFactory::create(auth()->user()->company()->id, auth()->user()->id)); + /** @var \App\Models\User $user */ + $user = auth()->user(); + + $task = $this->task_repo->save($request->all(), TaskFactory::create($user->company()->id, $user->id)); $task = $this->task_repo->triggeredActions($request, $task); - event(new TaskWasCreated($task, $task->company, Ninja::eventVars(auth()->user() ? auth()->user()->id : null))); + event(new TaskWasCreated($task, $task->company, Ninja::eventVars($user->id))); event('eloquent.created: App\Models\Task', $task); @@ -499,7 +505,9 @@ class TaskController extends BaseController $tasks = Task::withTrashed()->find($this->transformKeys($ids)); $tasks->each(function ($task, $key) use ($action) { - if (auth()->user()->can('edit', $task)) { + /** @var \App\Models\User $user */ + $user = auth()->user(); + if ($user->can('edit', $task)) { $this->task_repo->{$action}($task); } }); @@ -621,10 +629,13 @@ class TaskController extends BaseController { $task_statuses = $request->input('status_ids'); $tasks = $request->input('task_ids'); + + /** @var \App\Models\User $user */ + $user = auth()->user(); - collect($task_statuses)->each(function ($task_status_hashed_id, $key) { - $task_status = TaskStatus::where('id', $this->decodePrimaryKey($task_status_hashed_id)) - ->where('company_id', auth()->user()->company()->id) + collect($task_statuses)->each(function ($task_status_hashed_id, $key) use($user){ + $task_status = TaskStatus::query()->where('id', $this->decodePrimaryKey($task_status_hashed_id)) + ->where('company_id', $user->company()->id) ->withTrashed() ->first(); @@ -636,8 +647,8 @@ class TaskController extends BaseController $sort_status_id = $this->decodePrimaryKey($key); foreach ($task_list as $key => $task) { - $task_record = Task::where('id', $this->decodePrimaryKey($task)) - ->where('company_id', auth()->user()->company()->id) + $task_record = Task::query()->where('id', $this->decodePrimaryKey($task)) + ->where('company_id', $user->company()->id) ->withTrashed() ->first(); diff --git a/app/Http/Controllers/VendorPortal/VendorContactHashLoginController.php b/app/Http/Controllers/VendorPortal/VendorContactHashLoginController.php index 102b3634a2b9..6ee0d7fefe84 100644 --- a/app/Http/Controllers/VendorPortal/VendorContactHashLoginController.php +++ b/app/Http/Controllers/VendorPortal/VendorContactHashLoginController.php @@ -26,6 +26,10 @@ class VendorContactHashLoginController extends Controller return redirect('/vendors/purchase_orders'); } + /** + * @return \Illuminate\Support\Facades\Redirect + */ + public function magicLink(string $magic_link) { return redirect($this->setRedirectPath()); diff --git a/app/Http/Controllers/WebhookController.php b/app/Http/Controllers/WebhookController.php index d7a2a581e43a..e9046d970ef8 100644 --- a/app/Http/Controllers/WebhookController.php +++ b/app/Http/Controllers/WebhookController.php @@ -298,7 +298,10 @@ class WebhookController extends BaseController */ public function create(CreateWebhookRequest $request) { - $webhook = WebhookFactory::create(auth()->user()->company()->id, auth()->user()->id); + /** @var \App\Models\User $user */ + $user = auth()->user(); + + $webhook = WebhookFactory::create($user->company()->id, $user->id); $webhook->fill($request->all()); $webhook->save(); @@ -483,7 +486,10 @@ class WebhookController extends BaseController $webhooks = Webhook::withTrashed()->find($this->transformKeys($ids)); $webhooks->each(function ($webhook, $key) use ($action) { - if (auth()->user()->can('edit', $webhook)) { + /** @var \App\Models\User $user */ + $user = auth()->user(); + + if ($user->can('edit', $webhook)) { $this->base_repo->{$action}($webhook); } }); @@ -493,6 +499,8 @@ class WebhookController extends BaseController public function retry(RetryWebhookRequest $request, Webhook $webhook) { + $includes = ''; + match ($request->entity) { 'invoice' => $includes ='client', 'payment' => $includes ='invoices,client', @@ -504,13 +512,16 @@ class WebhookController extends BaseController $class = 'App\Models\\'.ucfirst(Str::camel($request->entity)); - $entity = $class::withTrashed()->where('id', $this->decodePrimaryKey($request->entity_id))->company()->first(); + $entity = $class::query()->withTrashed()->where('id', $this->decodePrimaryKey($request->entity_id))->company()->first(); if (!$entity) { return response()->json(['message' => ctrans('texts.record_not_found')], 400); } + + /** @var \App\Models\User $user */ + $user = auth()->user(); - WebhookSingle::dispatchSync($webhook->id, $entity, auth()->user()->company()->db, $includes); + WebhookSingle::dispatchSync($webhook->id, $entity, $user->company()->db, $includes); return $this->itemResponse($webhook); } diff --git a/app/Http/Livewire/BillingPortalPurchase.php b/app/Http/Livewire/BillingPortalPurchase.php index 715eab092f9e..d578f261b7ca 100644 --- a/app/Http/Livewire/BillingPortalPurchase.php +++ b/app/Http/Livewire/BillingPortalPurchase.php @@ -78,7 +78,6 @@ class BillingPortalPurchase extends Component /** * Rules for validating the form. * - * @var \string[][] */ protected $rules = [ 'email' => ['required', 'email'], diff --git a/app/Http/Requests/Statements/CreateStatementRequest.php b/app/Http/Requests/Statements/CreateStatementRequest.php index a2ac1204dabd..3406be9468e5 100644 --- a/app/Http/Requests/Statements/CreateStatementRequest.php +++ b/app/Http/Requests/Statements/CreateStatementRequest.php @@ -57,6 +57,6 @@ class CreateStatementRequest extends Request public function client(): ?Client { - return Client::without('company')->where('id', $this->client_id)->withTrashed()->first(); + return Client::query()->without('company')->where('id', $this->client_id)->withTrashed()->first(); } } diff --git a/app/Http/ValidationRules/Credit/UniqueCreditNumberRule.php b/app/Http/ValidationRules/Credit/UniqueCreditNumberRule.php index b869613defaa..0c2062948801 100644 --- a/app/Http/ValidationRules/Credit/UniqueCreditNumberRule.php +++ b/app/Http/ValidationRules/Credit/UniqueCreditNumberRule.php @@ -49,7 +49,7 @@ class UniqueCreditNumberRule implements Rule */ private function checkIfCreditNumberUnique() : bool { - $credit = Credit::where('client_id', $this->input['client_id']) + $credit = Credit::query()->where('client_id', $this->input['client_id']) ->where('number', $this->input['number']) ->withTrashed() ->exists(); diff --git a/app/Http/ValidationRules/Invoice/UniqueInvoiceNumberRule.php b/app/Http/ValidationRules/Invoice/UniqueInvoiceNumberRule.php index fa289f5e489f..215367fae4c7 100644 --- a/app/Http/ValidationRules/Invoice/UniqueInvoiceNumberRule.php +++ b/app/Http/ValidationRules/Invoice/UniqueInvoiceNumberRule.php @@ -53,7 +53,7 @@ class UniqueInvoiceNumberRule implements Rule return true; } - $invoice = Invoice::where('client_id', $this->input['client_id']) + $invoice = Invoice::query()->where('client_id', $this->input['client_id']) ->where('number', $this->input['number']) ->withTrashed() ->exists(); diff --git a/app/Http/ValidationRules/Payment/ValidRefundableRequest.php b/app/Http/ValidationRules/Payment/ValidRefundableRequest.php index db2f8ad2e1c5..44e4c53ae364 100644 --- a/app/Http/ValidationRules/Payment/ValidRefundableRequest.php +++ b/app/Http/ValidationRules/Payment/ValidRefundableRequest.php @@ -46,8 +46,7 @@ class ValidRefundableRequest implements Rule return false; } - /**@var \App\Models\Payment $payment **/ - $payment = Payment::where('id', $this->input['id'])->withTrashed()->first(); + $payment = Payment::query()->where('id', $this->input['id'])->withTrashed()->first(); if (! $payment) { $this->error_msg = ctrans('texts.unable_to_retrieve_payment'); @@ -77,7 +76,7 @@ class ValidRefundableRequest implements Rule private function checkInvoiceIsPaymentable($invoice, $payment) { /**@var \App\Models\Invoice $invoice **/ - $invoice = Invoice::where('id', $invoice['invoice_id'])->where('company_id', $payment->company_id)->withTrashed()->first(); + $invoice = Invoice::query()->where('id', $invoice['invoice_id'])->where('company_id', $payment->company_id)->withTrashed()->first(); if (! $invoice) { $this->error_msg = 'Invoice not found for refund'; diff --git a/app/Http/ValidationRules/Quote/UniqueQuoteNumberRule.php b/app/Http/ValidationRules/Quote/UniqueQuoteNumberRule.php index c10867372714..48acdf6ffde0 100644 --- a/app/Http/ValidationRules/Quote/UniqueQuoteNumberRule.php +++ b/app/Http/ValidationRules/Quote/UniqueQuoteNumberRule.php @@ -49,7 +49,7 @@ class UniqueQuoteNumberRule implements Rule */ private function checkIfQuoteNumberUnique() : bool { - $quote = Quote::where('client_id', $this->input['client_id']) + $quote = Quote::query()->where('client_id', $this->input['client_id']) ->where('number', $this->input['number']) ->withTrashed() ->exists(); diff --git a/app/Http/ValidationRules/Recurring/UniqueRecurringInvoiceNumberRule.php b/app/Http/ValidationRules/Recurring/UniqueRecurringInvoiceNumberRule.php index 5eb1ef2b64cc..e87e4b97d9ff 100644 --- a/app/Http/ValidationRules/Recurring/UniqueRecurringInvoiceNumberRule.php +++ b/app/Http/ValidationRules/Recurring/UniqueRecurringInvoiceNumberRule.php @@ -53,7 +53,7 @@ class UniqueRecurringInvoiceNumberRule implements Rule return true; } - $invoice = RecurringInvoice::where('client_id', $this->input['client_id']) + $invoice = RecurringInvoice::query()->where('client_id', $this->input['client_id']) ->where('number', $this->input['number']) ->withTrashed() ->exists(); diff --git a/app/Http/ValidationRules/Recurring/UniqueRecurringQuoteNumberRule.php b/app/Http/ValidationRules/Recurring/UniqueRecurringQuoteNumberRule.php index 278ac2164364..98951c70c95f 100644 --- a/app/Http/ValidationRules/Recurring/UniqueRecurringQuoteNumberRule.php +++ b/app/Http/ValidationRules/Recurring/UniqueRecurringQuoteNumberRule.php @@ -53,7 +53,7 @@ class UniqueRecurringQuoteNumberRule implements Rule return true; } - $invoice = RecurringQuote::where('client_id', $this->input['client_id']) + $invoice = RecurringQuote::query()->where('client_id', $this->input['client_id']) ->where('number', $this->input['number']) ->withTrashed() ->exists(); diff --git a/app/Import/Providers/BaseImport.php b/app/Import/Providers/BaseImport.php index 04780c6fc2ea..988c85b520b7 100644 --- a/app/Import/Providers/BaseImport.php +++ b/app/Import/Providers/BaseImport.php @@ -95,6 +95,7 @@ class BaseImport ini_set('auto_detect_line_endings', '1'); } + /** @var strin $base64_encoded_csv */ $base64_encoded_csv = Cache::pull($this->hash.'-'.$entity_type); if (empty($base64_encoded_csv)) { @@ -103,7 +104,7 @@ class BaseImport $csv = base64_decode($base64_encoded_csv); $csv = mb_convert_encoding($csv, 'UTF-8', 'UTF-8'); - nlog($csv); + $csv = Reader::createFromString($csv); $csvdelimiter = self::detectDelimiter($csv); diff --git a/app/Jobs/Bank/ProcessBankTransactions.php b/app/Jobs/Bank/ProcessBankTransactions.php index aeb309c50e7c..c5af8fd49a02 100644 --- a/app/Jobs/Bank/ProcessBankTransactions.php +++ b/app/Jobs/Bank/ProcessBankTransactions.php @@ -158,7 +158,7 @@ class ProcessBankTransactions implements ShouldQueue $now = now(); foreach ($transactions as $transaction) { - if (BankTransaction::where('transaction_id', $transaction['transaction_id'])->where('company_id', $this->company->id)->withTrashed()->exists()) { + if (BankTransaction::query()->where('transaction_id', $transaction['transaction_id'])->where('company_id', $this->company->id)->withTrashed()->exists()) { continue; } diff --git a/app/Jobs/Company/CompanyExport.php b/app/Jobs/Company/CompanyExport.php index b41b4ed2ef4d..0cbb91f9a5c1 100644 --- a/app/Jobs/Company/CompanyExport.php +++ b/app/Jobs/Company/CompanyExport.php @@ -187,7 +187,7 @@ class CompanyExport implements ShouldQueue })->all(); - $this->export_data['credit_invitations'] = CreditInvitation::where('company_id', $this->company->id)->withTrashed()->cursor()->map(function ($credit) { + $this->export_data['credit_invitations'] = CreditInvitation::query()->where('company_id', $this->company->id)->withTrashed()->cursor()->map(function ($credit) { $credit = $this->transformArrayOfKeys($credit, ['company_id', 'user_id', 'client_contact_id', 'credit_id']); return $credit->makeVisible(['id']); @@ -236,7 +236,7 @@ class CompanyExport implements ShouldQueue })->all(); - $this->export_data['invoice_invitations'] = InvoiceInvitation::where('company_id', $this->company->id)->withTrashed()->cursor()->map(function ($invoice) { + $this->export_data['invoice_invitations'] = InvoiceInvitation::query()->where('company_id', $this->company->id)->withTrashed()->cursor()->map(function ($invoice) { $invoice = $this->transformArrayOfKeys($invoice, ['company_id', 'user_id', 'client_contact_id', 'invoice_id']); return $invoice->makeVisible(['id']); @@ -280,7 +280,7 @@ class CompanyExport implements ShouldQueue })->all(); - $this->export_data['quote_invitations'] = QuoteInvitation::where('company_id', $this->company->id)->withTrashed()->cursor()->map(function ($quote) { + $this->export_data['quote_invitations'] = QuoteInvitation::query()->where('company_id', $this->company->id)->withTrashed()->cursor()->map(function ($quote) { $quote = $this->transformArrayOfKeys($quote, ['company_id', 'user_id', 'client_contact_id', 'quote_id']); return $quote->makeVisible(['id']); @@ -301,7 +301,7 @@ class CompanyExport implements ShouldQueue })->all(); - $this->export_data['recurring_invoice_invitations'] = RecurringInvoiceInvitation::where('company_id', $this->company->id)->withTrashed()->cursor()->map(function ($ri) { + $this->export_data['recurring_invoice_invitations'] = RecurringInvoiceInvitation::query()->where('company_id', $this->company->id)->withTrashed()->cursor()->map(function ($ri) { $ri = $this->transformArrayOfKeys($ri, ['company_id', 'user_id', 'client_contact_id', 'recurring_invoice_id']); return $ri; @@ -381,7 +381,7 @@ class CompanyExport implements ShouldQueue 'company_id',]); })->all(); - $this->export_data['purchase_order_invitations'] = PurchaseOrderInvitation::where('company_id', $this->company->id)->withTrashed()->cursor()->map(function ($purchase_order) { + $this->export_data['purchase_order_invitations'] = PurchaseOrderInvitation::query()->where('company_id', $this->company->id)->withTrashed()->cursor()->map(function ($purchase_order) { $purchase_order = $this->transformArrayOfKeys($purchase_order, ['company_id', 'user_id', 'vendor_contact_id', 'purchase_order_id']); return $purchase_order->makeVisible(['id']); diff --git a/app/Jobs/Util/Import.php b/app/Jobs/Util/Import.php index 0d2e837983ed..d35b50cb7027 100644 --- a/app/Jobs/Util/Import.php +++ b/app/Jobs/Util/Import.php @@ -1482,7 +1482,7 @@ class Import implements ShouldQueue try { $invoice_id = $this->transformId('invoices', $resource['invoice_id']); - $entity = Invoice::where('id', $invoice_id)->withTrashed()->first(); + $entity = Invoice::query()->where('id', $invoice_id)->withTrashed()->first(); } catch(\Exception $e) { nlog("i couldn't find the invoice document {$resource['invoice_id']}, perhaps it is a quote?"); nlog($e->getMessage()); @@ -1493,7 +1493,7 @@ class Import implements ShouldQueue if ($try_quote && array_key_exists('quotes', $this->ids)) { try { $quote_id = $this->transformId('quotes', $resource['invoice_id']); - $entity = Quote::where('id', $quote_id)->withTrashed()->first(); + $entity = Quote::query()->where('id', $quote_id)->withTrashed()->first(); } catch(\Exception $e) { nlog("i couldn't find the quote document {$resource['invoice_id']}, perhaps it is a quote?"); nlog($e->getMessage()); @@ -1509,7 +1509,7 @@ class Import implements ShouldQueue if (array_key_exists('expense_id', $resource) && $resource['expense_id'] && array_key_exists('expenses', $this->ids)) { $expense_id = $this->transformId('expenses', $resource['expense_id']); - $entity = Expense::where('id', $expense_id)->withTrashed()->first(); + $entity = Expense::query()->where('id', $expense_id)->withTrashed()->first(); } $file_url = $resource['url']; diff --git a/app/Models/BaseModel.php b/app/Models/BaseModel.php index cf4e39b2e3f2..09f5571565df 100644 --- a/app/Models/BaseModel.php +++ b/app/Models/BaseModel.php @@ -37,10 +37,12 @@ use Illuminate\Database\Eloquent\ModelNotFoundException as ModelNotFoundExceptio * @property int $assigned_user_id * @method BaseModel service() * @property \App\Models\Company $company + * @property \App\Models\Vendor $vendor * @method static BaseModel find($value) * @method static \Illuminate\Database\Eloquent\Builder|BaseModel company() * @method static \Illuminate\Database\Eloquent\Builder|BaseModel|Illuminate\Database\Eloquent\Relations\BelongsTo|\Awobaz\Compoships\Database\Eloquent\Relations\BelongsTo|\App\Models\Company company() * @method static \Illuminate\Database\Eloquent\Builder|BaseModel|Illuminate\Database\Eloquent\Relations\HasMany|BaseModel orderBy() + * @method static \Illuminate\Database\Eloquent\Builder|BaseModel on(?string $connection = null) * @method static \Illuminate\Database\Eloquent\Builder|BaseModel exclude($columns) * @method static \Illuminate\Database\Eloquent\Builder|BaseModel with($value) * @method static \Illuminate\Database\Eloquent\Builder|BaseModel newModelQuery($query) @@ -55,6 +57,7 @@ use Illuminate\Database\Eloquent\ModelNotFoundException as ModelNotFoundExceptio * @method static \Illuminate\Database\Eloquent\Builder|BaseModel orderBy($column, $direction) * @method static \Illuminate\Database\Eloquent\Builder|BaseModel invitations() * @method static \Illuminate\Database\Eloquent\Builder|BaseModel whereHas($query) + * @method static \Illuminate\Database\Eloquent\Builder|BaseModel without($query) * @property-read \Illuminate\Database\Eloquent\Collection $invitations * @property-read int|null $invitations_count * @method int companyId() diff --git a/app/Models/Client.php b/app/Models/Client.php index fd85ef504d90..ac764cbcf632 100644 --- a/app/Models/Client.php +++ b/app/Models/Client.php @@ -79,50 +79,33 @@ use Illuminate\Contracts\Translation\HasLocalePreference; * @property int|null $updated_at * @property int|null $deleted_at * @property string|null $id_number - * @property-read \Illuminate\Database\Eloquent\Collection $activities - * @property-read int|null $activities_count - * @property-read \App\Models\User|null $assigned_user - * @property-read \App\Models\Company $company - * @property-read \Illuminate\Database\Eloquent\Collection $company_ledger - * @property-read int|null $company_ledger_count - * @property-read \Illuminate\Database\Eloquent\Collection $contacts - * @property-read int|null $contacts_count - * @property-read \App\Models\Country|null $country - * @property-read \Illuminate\Database\Eloquent\Collection $credits - * @property-read int|null $credits_count - * @property-read \Illuminate\Database\Eloquent\Collection $documents - * @property-read int|null $documents_count - * @property-read \Illuminate\Database\Eloquent\Collection $expenses - * @property-read int|null $expenses_count - * @property-read \Illuminate\Database\Eloquent\Collection $gateway_tokens - * @property-read int|null $gateway_tokens_count * @property-read mixed $hashed_id + * @property-read \App\Models\User|null $assigned_user + * @property-read \App\Models\User $user + * @property-read \App\Models\Company $company + * @property-read \App\Models\Country|null $country + * @property-read \Illuminate\Database\Eloquent\Collection $activities + * @property-read \Illuminate\Database\Eloquent\Collection $company_ledger + * @property-read \Illuminate\Database\Eloquent\Collection $contacts + * @property-read \Illuminate\Database\Eloquent\Collection $credits + * @property-read \Illuminate\Database\Eloquent\Collection $documents + * @property-read \Illuminate\Database\Eloquent\Collection $expenses + * @property-read \Illuminate\Database\Eloquent\Collection $gateway_tokens * @property-read \Illuminate\Database\Eloquent\Collection $invoices - * @property-read int|null $invoices_count * @property-read \Illuminate\Database\Eloquent\Collection $ledger - * @property-read int|null $ledger_count * @property-read \Illuminate\Database\Eloquent\Collection $payments - * @property-read int|null $payments_count * @property-read \Illuminate\Database\Eloquent\Collection $primary_contact - * @property-read int|null $primary_contact_count * @property-read \Illuminate\Database\Eloquent\Collection $projects - * @property-read int|null $projects_count * @property-read \Illuminate\Database\Eloquent\Collection $quotes - * @property-read int|null $quotes_count * @property-read \Illuminate\Database\Eloquent\Collection $recurring_expenses - * @property-read int|null $recurring_expenses_count * @property-read \Illuminate\Database\Eloquent\Collection $recurring_invoices - * @property-read int|null $recurring_invoices_count - * @property-read \App\Models\Country|null $shipping_country * @property-read \Illuminate\Database\Eloquent\Collection $system_logs - * @property-read int|null $system_logs_count * @property-read \Illuminate\Database\Eloquent\Collection $tasks * @property-read \Illuminate\Database\Eloquent\Collection $recurring_invoices - * @property-read int|null $tasks_count - * @property-read \App\Models\User $user * @method static \Illuminate\Database\Eloquent\Builder|Client exclude($columns) * @method static \Database\Factories\ClientFactory factory($count = null, $state = []) * @method static \Illuminate\Database\Eloquent\Builder|Client filter(\App\Filters\QueryFilters $filters) + * @method static \Illuminate\Database\Eloquent\Builder|Client without() * @property string $payment_balance * @property mixed $tax_data * @property int $is_tax_exempt diff --git a/app/Models/PurchaseOrder.php b/app/Models/PurchaseOrder.php index 3639469776f7..917a1969e81a 100644 --- a/app/Models/PurchaseOrder.php +++ b/app/Models/PurchaseOrder.php @@ -112,6 +112,8 @@ use Illuminate\Support\Facades\Storage; * @property-read \Illuminate\Database\Eloquent\Collection $invitations * @property-read \Illuminate\Database\Eloquent\Collection $invoices * @property-read \Illuminate\Database\Eloquent\Collection $payments + * @method static \Illuminate\Database\Eloquent\Builder|Task withTrashed() + * @method static \Illuminate\Database\Eloquent\Builder|Task withoutTrashed() * @mixin \Eloquent */ class PurchaseOrder extends BaseModel diff --git a/app/Observers/CompanyGatewayObserver.php b/app/Observers/CompanyGatewayObserver.php index bc40e9fb0232..572c45af2ebd 100644 --- a/app/Observers/CompanyGatewayObserver.php +++ b/app/Observers/CompanyGatewayObserver.php @@ -54,7 +54,7 @@ class CompanyGatewayObserver public function restored(CompanyGateway $company_gateway) { //When we restore the gateway, bring back the tokens! - ClientGatewayToken::where('company_gateway_id', $company_gateway->id) + ClientGatewayToken::query()->where('company_gateway_id', $company_gateway->id) ->withTrashed()->cursor()->each(function ($cgt) { $cgt->restore(); }); diff --git a/app/Repositories/ActivityRepository.php b/app/Repositories/ActivityRepository.php index 129436d875e7..adafdfb2ca89 100644 --- a/app/Repositories/ActivityRepository.php +++ b/app/Repositories/ActivityRepository.php @@ -99,7 +99,7 @@ class ActivityRepository extends BaseRepository { if ($event_vars['token']) { /** @var \App\Models\CompanyToken $company_token **/ - $company_token = CompanyToken::where('token', $event_vars['token'])->first(); + $company_token = CompanyToken::query()->where('token', $event_vars['token'])->first(); if ($company_token) { return $company_token->id; diff --git a/app/Repositories/BaseRepository.php b/app/Repositories/BaseRepository.php index 13df4b4d8435..b2c5aaad97d2 100644 --- a/app/Repositories/BaseRepository.php +++ b/app/Repositories/BaseRepository.php @@ -224,7 +224,7 @@ class BaseRepository /* Get array of Keys which have been removed from the invitations array and soft delete each invitation */ $model->invitations->pluck('key')->diff($invitations->pluck('key'))->each(function ($invitation) use ($resource) { $invitation_class = sprintf('App\\Models\\%sInvitation', $resource); - $invitation = $invitation_class::where('key', $invitation)->first(); + $invitation = $invitation_class::query()->where('key', $invitation)->first(); if ($invitation) { $invitation->delete(); diff --git a/app/Repositories/CreditRepository.php b/app/Repositories/CreditRepository.php index f5097e8f9adf..79d83c36be67 100644 --- a/app/Repositories/CreditRepository.php +++ b/app/Repositories/CreditRepository.php @@ -41,7 +41,7 @@ class CreditRepository extends BaseRepository public function getInvitationByKey($key) :?CreditInvitation { - return CreditInvitation::where('key', $key)->first(); + return CreditInvitation::query()->where('key', $key)->first(); } public function delete($credit) diff --git a/app/Repositories/InvoiceRepository.php b/app/Repositories/InvoiceRepository.php index c7347da552b0..f3d4a4e6d481 100644 --- a/app/Repositories/InvoiceRepository.php +++ b/app/Repositories/InvoiceRepository.php @@ -49,7 +49,7 @@ class InvoiceRepository extends BaseRepository public function getInvitationByKey($key) :?InvoiceInvitation { - return InvoiceInvitation::where('key', $key)->first(); + return InvoiceInvitation::query()->where('key', $key)->first(); } /** diff --git a/app/Repositories/Migration/InvoiceMigrationRepository.php b/app/Repositories/Migration/InvoiceMigrationRepository.php index 40725e62020e..da1717a2f5b4 100644 --- a/app/Repositories/Migration/InvoiceMigrationRepository.php +++ b/app/Repositories/Migration/InvoiceMigrationRepository.php @@ -38,9 +38,9 @@ class InvoiceMigrationRepository extends BaseRepository $class = new ReflectionClass($model); if (array_key_exists('client_id', $data)) { - $client = Client::where('id', $data['client_id'])->withTrashed()->first(); + $client = Client::query()->where('id', $data['client_id'])->withTrashed()->first(); } else { - $client = Client::where('id', $model->client_id)->withTrashed()->first(); + $client = Client::query()->where('id', $model->client_id)->withTrashed()->first(); } $state = []; diff --git a/app/Repositories/Migration/PaymentMigrationRepository.php b/app/Repositories/Migration/PaymentMigrationRepository.php index 683355f4239a..f8f6f686b799 100644 --- a/app/Repositories/Migration/PaymentMigrationRepository.php +++ b/app/Repositories/Migration/PaymentMigrationRepository.php @@ -206,7 +206,7 @@ class PaymentMigrationRepository extends BaseRepository return $payment; } - $client = Client::where('id', $data['client_id'])->withTrashed()->first(); + $client = Client::query()->where('id', $data['client_id'])->withTrashed()->first(); $client_currency = $client->getSetting('currency_id'); $company_currency = $client->company->settings->currency_id; diff --git a/app/Repositories/PaymentRepository.php b/app/Repositories/PaymentRepository.php index 48fdd4a8e5e7..f11a6f3cebd6 100644 --- a/app/Repositories/PaymentRepository.php +++ b/app/Repositories/PaymentRepository.php @@ -76,7 +76,7 @@ class PaymentRepository extends BaseRepository $is_existing_payment = false; \DB::connection(config('database.default'))->transaction(function () use ($data) { - $client = Client::where('id', $data['client_id'])->withTrashed()->lockForUpdate()->first(); + $client = Client::query()->where('id', $data['client_id'])->withTrashed()->lockForUpdate()->first(); /*We only update the paid to date ONCE per payment*/ if (array_key_exists('invoices', $data) && is_array($data['invoices']) && count($data['invoices']) > 0) { diff --git a/app/Repositories/PurchaseOrderRepository.php b/app/Repositories/PurchaseOrderRepository.php index 321b4fa89891..71bd54a5b9e8 100644 --- a/app/Repositories/PurchaseOrderRepository.php +++ b/app/Repositories/PurchaseOrderRepository.php @@ -36,7 +36,7 @@ class PurchaseOrderRepository extends BaseRepository /* Get array of Keys which have been removed from the invitations array and soft delete each invitation */ $purchase_order->invitations->pluck('key')->diff($invitations->pluck('key'))->each(function ($invitation) { - $invitation = PurchaseOrderInvitation::where('key', $invitation)->first(); + $invitation = PurchaseOrderInvitation::query()->where('key', $invitation)->first(); if ($invitation) { $invitation->delete(); @@ -86,7 +86,7 @@ class PurchaseOrderRepository extends BaseRepository public function getInvitationByKey($key) :?PurchaseOrderInvitation { - return PurchaseOrderInvitation::where('key', $key)->first(); + return PurchaseOrderInvitation::query()->where('key', $key)->first(); } public function getInvitation($invitation, $resource = null) @@ -95,7 +95,7 @@ class PurchaseOrderRepository extends BaseRepository return false; } - $invitation = PurchaseOrderInvitation::where('key', $invitation['key'])->first(); + $invitation = PurchaseOrderInvitation::query()->where('key', $invitation['key'])->first(); return $invitation; } diff --git a/app/Repositories/QuoteRepository.php b/app/Repositories/QuoteRepository.php index 3d71199a55db..6a90b0c74d07 100644 --- a/app/Repositories/QuoteRepository.php +++ b/app/Repositories/QuoteRepository.php @@ -26,6 +26,6 @@ class QuoteRepository extends BaseRepository public function getInvitationByKey($key) :?QuoteInvitation { - return QuoteInvitation::where('key', $key)->first(); + return QuoteInvitation::query()->where('key', $key)->first(); } } diff --git a/app/Repositories/TaskStatusRepository.php b/app/Repositories/TaskStatusRepository.php index faf650ef2203..34a1f8e63642 100644 --- a/app/Repositories/TaskStatusRepository.php +++ b/app/Repositories/TaskStatusRepository.php @@ -22,12 +22,12 @@ class TaskStatusRepository extends BaseRepository public function delete($task_status) { /** @var \App\Models\TaskStatus $ts **/ - $ts = TaskStatus::where('company_id', $task_status->company_id) + $ts = TaskStatus::query()->where('company_id', $task_status->company_id) ->first(); $new_status = $ts ? $ts->id : null; - Task::where('status_id', $task_status->id) + Task::query()->where('status_id', $task_status->id) ->where('company_id', $task_status->company_id) ->update(['status_id' => $new_status]); @@ -60,7 +60,7 @@ class TaskStatusRepository extends BaseRepository public function reorder(TaskStatus $task_status) { - TaskStatus::where('company_id', $task_status->company_id) + TaskStatus::query()->where('company_id', $task_status->company_id) ->where('id', '!=', $task_status->id) ->orderByRaw('ISNULL(status_order), status_order ASC') ->cursor() @@ -77,7 +77,7 @@ class TaskStatusRepository extends BaseRepository }); - TaskStatus::where('company_id', $task_status->company_id) + TaskStatus::query()->where('company_id', $task_status->company_id) ->orderByRaw('ISNULL(status_order), status_order ASC') ->cursor() ->each(function ($ts, $key) { diff --git a/app/Repositories/UserRepository.php b/app/Repositories/UserRepository.php index ce870fe557f1..582812b74daf 100644 --- a/app/Repositories/UserRepository.php +++ b/app/Repositories/UserRepository.php @@ -81,7 +81,7 @@ class UserRepository extends BaseRepository $user->save(); if (isset($data['company_user'])) { - $cu = CompanyUser::whereUserId($user->id)->whereCompanyId($company->id)->withTrashed()->first(); + $cu = CompanyUser::query()->whereUserId($user->id)->whereCompanyId($company->id)->withTrashed()->first(); /*No company user exists - attach the user*/ if (! $cu) { @@ -129,7 +129,7 @@ class UserRepository extends BaseRepository $company = auth()->user()->company(); - $cu = CompanyUser::whereUserId($user->id) + $cu = CompanyUser::query()->whereUserId($user->id) ->whereCompanyId($company->id) ->first(); @@ -151,7 +151,7 @@ class UserRepository extends BaseRepository { $company = auth()->user()->company(); - $cu = CompanyUser::whereUserId($user->id) + $cu = CompanyUser::query()->whereUserId($user->id) ->whereCompanyId($company->id) ->first(); @@ -190,7 +190,7 @@ class UserRepository extends BaseRepository } if (Ninja::isHosted()) { - $count = User::where('account_id', auth()->user()->account_id)->count(); + $count = User::query()->where('account_id', auth()->user()->account_id)->count(); if ($count >= auth()->user()->account->num_users) { return; } diff --git a/app/Services/Bank/BankMatchingService.php b/app/Services/Bank/BankMatchingService.php index df013e77cc29..30eb58943e1a 100644 --- a/app/Services/Bank/BankMatchingService.php +++ b/app/Services/Bank/BankMatchingService.php @@ -31,7 +31,7 @@ class BankMatchingService implements ShouldQueue { MultiDB::setDb($this->db); - BankTransaction::where('company_id', $this->company_id) + BankTransaction::query()->where('company_id', $this->company_id) ->where('status_id', BankTransaction::STATUS_UNMATCHED) ->cursor() ->each(function ($bt) { diff --git a/app/Services/Bank/BankService.php b/app/Services/Bank/BankService.php index 1fc3a77ba946..42b1027a8501 100644 --- a/app/Services/Bank/BankService.php +++ b/app/Services/Bank/BankService.php @@ -24,7 +24,7 @@ class BankService public function matchInvoiceNumber() { if (strlen($this->bank_transaction->description) > 1) { - $i = Invoice::where('company_id', $this->bank_transaction->company_id) + $i = Invoice::query()->where('company_id', $this->bank_transaction->company_id) ->whereIn('status_id', [1,2,3]) ->where('is_deleted', 0) ->where('number', 'LIKE', '%'.$this->bank_transaction->description.'%') diff --git a/app/Services/Bank/ProcessBankRules.php b/app/Services/Bank/ProcessBankRules.php index 9daaacb6b161..fa9a9f6a8c53 100644 --- a/app/Services/Bank/ProcessBankRules.php +++ b/app/Services/Bank/ProcessBankRules.php @@ -49,7 +49,7 @@ class ProcessBankRules extends AbstractService private function matchCredit() { /** @var \Illuminate\Database\Eloquent\Collection $this->invoices */ - $this->invoices = Invoice::where('company_id', $this->bank_transaction->company_id) + $this->invoices = Invoice::query()->where('company_id', $this->bank_transaction->company_id) ->whereIn('status_id', [1,2,3]) ->where('is_deleted', 0) ->get(); @@ -153,7 +153,7 @@ class ProcessBankRules extends AbstractService { $category = $this->categories->firstWhere('highLevelCategoryId', $this->bank_transaction->category_id); - $ec = ExpenseCategory::where('company_id', $this->bank_transaction->company_id)->where('bank_category_id', $this->bank_transaction->category_id)->first(); + $ec = ExpenseCategory::query()->where('company_id', $this->bank_transaction->company_id)->where('bank_category_id', $this->bank_transaction->category_id)->first(); if ($ec) { return $ec->id; diff --git a/app/Services/Client/ClientService.php b/app/Services/Client/ClientService.php index 6e22782a298f..869f9e51f01a 100644 --- a/app/Services/Client/ClientService.php +++ b/app/Services/Client/ClientService.php @@ -78,7 +78,7 @@ class ClientService public function updatePaymentBalance() { - $amount = Payment::where('client_id', $this->client->id) + $amount = Payment::query()->where('client_id', $this->client->id) ->where('is_deleted', 0) ->whereIn('status_id', [Payment::STATUS_COMPLETED, Payment::STATUS_PENDING, Payment::STATUS_PARTIALLY_REFUNDED, Payment::STATUS_REFUNDED]) ->sum(DB::Raw('amount - applied')); @@ -115,7 +115,7 @@ class ClientService public function getCredits() { - return Credit::where('client_id', $this->client->id) + return Credit::query()->where('client_id', $this->client->id) ->where('is_deleted', false) ->where('balance', '>', 0) ->where(function ($query) { diff --git a/app/Services/Client/Merge.php b/app/Services/Client/Merge.php index a2f830a1bb8a..6dc11c342c3f 100644 --- a/app/Services/Client/Merge.php +++ b/app/Services/Client/Merge.php @@ -71,7 +71,7 @@ class Merge extends AbstractService { $balance = 0; - $company_ledger = CompanyLedger::whereClientId($this->client->id) + $company_ledger = CompanyLedger::query()->whereClientId($this->client->id) ->orderBy('id', 'DESC') ->first(); diff --git a/app/Services/ClientPortal/InstantPayment.php b/app/Services/ClientPortal/InstantPayment.php index 91832d9f20b9..a76482273d71 100644 --- a/app/Services/ClientPortal/InstantPayment.php +++ b/app/Services/ClientPortal/InstantPayment.php @@ -233,7 +233,7 @@ class InstantPayment $hash_data['billing_context'] = Cache::get($this->request->query('hash')); } elseif ($this->request->hash) { $hash_data['billing_context'] = Cache::get($this->request->hash); - } elseif ($old_hash = PaymentHash::where('fee_invoice_id', $first_invoice->id)->whereNull('payment_id')->first()) { + } elseif ($old_hash = PaymentHash::query()->where('fee_invoice_id', $first_invoice->id)->whereNull('payment_id')->first()) { if (isset($old_hash->data->billing_context)) { $hash_data['billing_context'] = $old_hash->data->billing_context; } diff --git a/app/Services/Credit/CreateInvitations.php b/app/Services/Credit/CreateInvitations.php index cf413f2444c8..449a6ac6ff62 100644 --- a/app/Services/Credit/CreateInvitations.php +++ b/app/Services/Credit/CreateInvitations.php @@ -66,7 +66,7 @@ class CreateInvitations extends AbstractService } else { $contact = $contacts->first(); - $invitation = CreditInvitation::where('company_id', $this->credit->company_id) + $invitation = CreditInvitation::query()->where('company_id', $this->credit->company_id) ->where('client_contact_id', $contact->id) ->where('credit_id', $this->credit->id) ->withTrashed() diff --git a/app/Services/Invoice/AutoBillInvoice.php b/app/Services/Invoice/AutoBillInvoice.php index c05aecf18ba4..f776cbc4af10 100644 --- a/app/Services/Invoice/AutoBillInvoice.php +++ b/app/Services/Invoice/AutoBillInvoice.php @@ -250,7 +250,7 @@ class AutoBillInvoice extends AbstractService */ private function applyCreditPayment(): self { - $available_credits = Credit::where('client_id', $this->client->id) + $available_credits = Credit::query()->where('client_id', $this->client->id) ->where('is_deleted', false) ->where('balance', '>', 0) ->orderBy('created_at') diff --git a/app/Services/Invoice/CreateInvitations.php b/app/Services/Invoice/CreateInvitations.php index 5261df58f1b3..853090f5d166 100644 --- a/app/Services/Invoice/CreateInvitations.php +++ b/app/Services/Invoice/CreateInvitations.php @@ -39,7 +39,7 @@ class CreateInvitations extends AbstractService } $contacts->each(function ($contact) { - $invitation = InvoiceInvitation::where('company_id', $this->invoice->company_id) + $invitation = InvoiceInvitation::query()->where('company_id', $this->invoice->company_id) ->where('client_contact_id', $contact->id) ->where('invoice_id', $this->invoice->id) ->withTrashed() @@ -62,7 +62,7 @@ class CreateInvitations extends AbstractService } else { $contact = $contacts->first(); - $invitation = InvoiceInvitation::where('company_id', $this->invoice->company_id) + $invitation = InvoiceInvitation::query()->where('company_id', $this->invoice->company_id) ->where('client_contact_id', $contact->id) ->where('invoice_id', $this->invoice->id) ->withTrashed() diff --git a/app/Services/Invoice/HandleRestore.php b/app/Services/Invoice/HandleRestore.php index d5bf6c8275ba..de3a990baad2 100644 --- a/app/Services/Invoice/HandleRestore.php +++ b/app/Services/Invoice/HandleRestore.php @@ -165,7 +165,7 @@ class HandleRestore extends AbstractService } try { - $exists = Invoice::where(['company_id' => $this->invoice->company_id, 'number' => $new_invoice_number])->exists(); + $exists = Invoice::query()->where(['company_id' => $this->invoice->company_id, 'number' => $new_invoice_number])->exists(); if ($exists) { $this->invoice->number = $this->getNextInvoiceNumber($this->invoice->client, $this->invoice, $this->invoice->recurring_id); diff --git a/app/Services/Invoice/HandleReversal.php b/app/Services/Invoice/HandleReversal.php index 58d566e51ce0..2b1410950e12 100644 --- a/app/Services/Invoice/HandleReversal.php +++ b/app/Services/Invoice/HandleReversal.php @@ -44,7 +44,7 @@ class HandleReversal extends AbstractService $total_paid = $this->invoice->amount - $this->invoice->balance; /*Adjust payment applied and the paymentables to the correct amount */ - $paymentables = Paymentable::wherePaymentableType('invoices') + $paymentables = Paymentable::query()->wherePaymentableType('invoices') ->wherePaymentableId($this->invoice->id) ->get(); diff --git a/app/Services/Payment/DeletePayment.php b/app/Services/Payment/DeletePayment.php index 6c99757ea25e..27119ec5ca12 100644 --- a/app/Services/Payment/DeletePayment.php +++ b/app/Services/Payment/DeletePayment.php @@ -58,7 +58,7 @@ class DeletePayment $this->payment->is_deleted = true; $this->payment->delete(); - BankTransaction::where('payment_id', $this->payment->id)->cursor()->each(function ($bt){ + BankTransaction::query()->where('payment_id', $this->payment->id)->cursor()->each(function ($bt){ $bt->payment_id = null; $bt->save(); }); diff --git a/app/Services/PurchaseOrder/CreateInvitations.php b/app/Services/PurchaseOrder/CreateInvitations.php index c33091bdc558..cef458d4e2fe 100644 --- a/app/Services/PurchaseOrder/CreateInvitations.php +++ b/app/Services/PurchaseOrder/CreateInvitations.php @@ -51,7 +51,7 @@ class CreateInvitations extends AbstractService } $contacts->each(function ($contact) { - $invitation = PurchaseOrderInvitation::where('company_id', $this->purchase_order->company_id) + $invitation = PurchaseOrderInvitation::query()->where('company_id', $this->purchase_order->company_id) ->where('vendor_contact_id', $contact->id) ->where('purchase_order_id', $this->purchase_order->id) ->withTrashed() @@ -78,7 +78,7 @@ class CreateInvitations extends AbstractService } else { $contact = $contacts->first(); - $invitation = PurchaseOrderInvitation::where('company_id', $this->purchase_order->company_id) + $invitation = PurchaseOrderInvitation::query()->where('company_id', $this->purchase_order->company_id) ->where('vendor_contact_id', $contact->id) ->where('purchase_order_id', $this->purchase_order->id) ->withTrashed() diff --git a/app/Services/PurchaseOrder/PurchaseOrderInventory.php b/app/Services/PurchaseOrder/PurchaseOrderInventory.php index 298c5718f617..e3e6036bf5a2 100644 --- a/app/Services/PurchaseOrder/PurchaseOrderInventory.php +++ b/app/Services/PurchaseOrder/PurchaseOrderInventory.php @@ -28,7 +28,7 @@ class PurchaseOrderInventory $line_items = $this->purchase_order->line_items; foreach ($line_items as $item) { - $p = Product::where('product_key', $item->product_key)->where('company_id', $this->purchase_order->company_id)->first(); + $p = Product::query()->where('product_key', $item->product_key)->where('company_id', $this->purchase_order->company_id)->first(); if (!$p) { continue; diff --git a/app/Services/Quote/CreateInvitations.php b/app/Services/Quote/CreateInvitations.php index 8ba5090c3983..933bbdbe9de9 100644 --- a/app/Services/Quote/CreateInvitations.php +++ b/app/Services/Quote/CreateInvitations.php @@ -65,7 +65,7 @@ class CreateInvitations } else { $contact = $contacts->first(); - $invitation = QuoteInvitation::where('company_id', $this->quote->company_id) + $invitation = QuoteInvitation::query()->where('company_id', $this->quote->company_id) ->where('client_contact_id', $contact->id) ->where('quote_id', $this->quote->id) ->withTrashed() diff --git a/app/Services/Recurring/CreateRecurringInvitations.php b/app/Services/Recurring/CreateRecurringInvitations.php index 128c3bab1934..4fb3a7b1c1fa 100644 --- a/app/Services/Recurring/CreateRecurringInvitations.php +++ b/app/Services/Recurring/CreateRecurringInvitations.php @@ -43,7 +43,7 @@ class CreateRecurringInvitations extends AbstractService { try { $this->entity->client->contacts->each(function ($contact) { - $invitation = $this->invitation_class::whereCompanyId($this->entity->company_id) + $invitation = $this->invitation_class::query()->whereCompanyId($this->entity->company_id) ->whereClientContactId($contact->id) ->where($this->entity_id_name, $this->entity->id) ->withTrashed() @@ -64,7 +64,7 @@ class CreateRecurringInvitations extends AbstractService } if ($this->entity->invitations()->count() == 0) { - $invitation = $this->invitation_class::where('company_id', $this->entity->company_id) + $invitation = $this->invitation_class::query()->where('company_id', $this->entity->company_id) ->where($this->entity_id_name, $this->entity->id) ->withTrashed() ->first(); diff --git a/app/Services/Recurring/UpdatePrice.php b/app/Services/Recurring/UpdatePrice.php index 77c729669bdc..bb8c7b2662bb 100644 --- a/app/Services/Recurring/UpdatePrice.php +++ b/app/Services/Recurring/UpdatePrice.php @@ -28,7 +28,7 @@ class UpdatePrice extends AbstractService foreach ($line_items as $key => $line_item) { /** @var \App\Models\Product $product **/ - $product = Product::where('company_id', $this->recurring_invoice->company_id) + $product = Product::query()->where('company_id', $this->recurring_invoice->company_id) ->where('product_key', $line_item->product_key) ->where('is_deleted', 0) ->first(); diff --git a/app/Services/Report/ClientBalanceReport.php b/app/Services/Report/ClientBalanceReport.php index d94679776106..0c0eb85aca29 100644 --- a/app/Services/Report/ClientBalanceReport.php +++ b/app/Services/Report/ClientBalanceReport.php @@ -105,7 +105,7 @@ class ClientBalanceReport extends BaseExport } private function buildRow(Client $client): array { - $query = Invoice::where('client_id', $client->id) + $query = Invoice::query()->where('client_id', $client->id) ->whereIn('status_id', [Invoice::STATUS_SENT, Invoice::STATUS_PARTIAL]); $query = $this->addDateRange($query); diff --git a/app/Services/Report/ClientSalesReport.php b/app/Services/Report/ClientSalesReport.php index 61e25ed58265..7bb5b47d8324 100644 --- a/app/Services/Report/ClientSalesReport.php +++ b/app/Services/Report/ClientSalesReport.php @@ -99,7 +99,7 @@ class ClientSalesReport extends BaseExport private function buildRow(Client $client): array { - $query = Invoice::where('client_id', $client->id) + $query = Invoice::query()->where('client_id', $client->id) ->whereIn('status_id', [Invoice::STATUS_SENT, Invoice::STATUS_PARTIAL, Invoice::STATUS_PAID]); $query = $this->addDateRange($query); diff --git a/app/Services/Report/ProfitLoss.php b/app/Services/Report/ProfitLoss.php index d070b7636614..56bf7ae7b55e 100644 --- a/app/Services/Report/ProfitLoss.php +++ b/app/Services/Report/ProfitLoss.php @@ -270,7 +270,7 @@ class ProfitLoss { $this->invoice_payment_map = []; - Payment::where('company_id', $this->company->id) + Payment::query()->where('company_id', $this->company->id) ->whereIn('status_id', [1, 4, 5]) ->where('is_deleted', 0) ->whereBetween('date', [$this->start_date, $this->end_date]) @@ -452,7 +452,7 @@ class ProfitLoss private function expenseData() { - $expenses = Expense::where('company_id', $this->company->id) + $expenses = Expense::query()->where('company_id', $this->company->id) ->where('is_deleted', 0) ->withTrashed() ->whereBetween('date', [$this->start_date, $this->end_date]) diff --git a/app/Services/Subscription/SubscriptionService.php b/app/Services/Subscription/SubscriptionService.php index efb30352866f..a8dbeb7da64b 100644 --- a/app/Services/Subscription/SubscriptionService.php +++ b/app/Services/Subscription/SubscriptionService.php @@ -347,7 +347,7 @@ class SubscriptionService $outstanding_amounts = $outstanding->sum('balance'); - $outstanding_invoice = Invoice::where('client_id', $recurring_invoice->client_id) + $outstanding_invoice = Invoice::query()->where('client_id', $recurring_invoice->client_id) ->where('is_deleted', 0) ->where('is_proforma', 0) ->where('subscription_id', $this->subscription->id) @@ -356,7 +356,7 @@ class SubscriptionService //sometimes the last document could be a credit if the user is paying for their service with credits. if (!$outstanding_invoice) { - $outstanding_invoice = Credit::where('subscription_id', $this->subscription->id) + $outstanding_invoice = Credit::query()->where('subscription_id', $this->subscription->id) ->where('client_id', $recurring_invoice->client_id) ->where('is_proforma', 0) ->where('is_deleted', 0) @@ -655,7 +655,7 @@ class SubscriptionService $pro_rata_refund_amount = 0; $is_credit = false; - $last_invoice = Invoice::where('subscription_id', $recurring_invoice->subscription_id) + $last_invoice = Invoice::query()->where('subscription_id', $recurring_invoice->subscription_id) ->where('client_id', $recurring_invoice->client_id) ->where('is_deleted', 0) ->withTrashed() @@ -667,7 +667,7 @@ class SubscriptionService } elseif (!$last_invoice) { $is_credit = true; - $last_invoice = Credit::where('subscription_id', $recurring_invoice->subscription_id) + $last_invoice = Credit::query()->where('subscription_id', $recurring_invoice->subscription_id) ->where('client_id', $recurring_invoice->client_id) ->where('is_deleted', 0) ->withTrashed() @@ -728,7 +728,7 @@ class SubscriptionService $pro_rata_charge_amount = 0; $pro_rata_refund_amount = 0; - $last_invoice = Invoice::where('subscription_id', $recurring_invoice->subscription_id) + $last_invoice = Invoice::query()->where('subscription_id', $recurring_invoice->subscription_id) ->where('client_id', $recurring_invoice->client_id) ->where('is_proforma', 0) ->where('is_deleted', 0) @@ -773,7 +773,7 @@ class SubscriptionService $pro_rata_charge_amount = 0; $pro_rata_refund_amount = 0; - $last_invoice = Invoice::where('subscription_id', $recurring_invoice->subscription_id) + $last_invoice = Invoice::query()->where('subscription_id', $recurring_invoice->subscription_id) ->where('client_id', $recurring_invoice->client_id) ->where('is_deleted', 0) ->where('is_proforma', 0) @@ -1127,7 +1127,7 @@ class SubscriptionService $body = $response->getStatusCode(); } - $client = Client::where('id', $this->decodePrimaryKey($body['client']))->withTrashed()->first(); + $client = Client::query()->where('id', $this->decodePrimaryKey($body['client']))->withTrashed()->first(); SystemLogger::dispatch( $body, @@ -1168,7 +1168,7 @@ class SubscriptionService if (is_array($keys)) { return Product::query()->whereIn('id', $keys)->get(); } else { - return Product::where('id', $keys)->get(); + return Product::query()->where('id', $keys)->get(); } } @@ -1188,7 +1188,7 @@ class SubscriptionService if (is_array($keys)) { return Product::query()->whereIn('id', $keys)->get(); } else { - return Product::where('id', $keys)->get(); + return Product::query()->where('id', $keys)->get(); } } @@ -1209,7 +1209,7 @@ class SubscriptionService if (is_array($keys)) { return Product::query()->whereIn('id', $keys)->get(); } else { - return Product::where('id', $keys)->get(); + return Product::query()->where('id', $keys)->get(); } } @@ -1229,7 +1229,7 @@ class SubscriptionService if (is_array($keys)) { return Product::query()->whereIn('id', $keys)->get(); } else { - return Product::where('id', $keys)->get(); + return Product::query()->where('id', $keys)->get(); } } @@ -1267,7 +1267,7 @@ class SubscriptionService $gateway_refund_attempted = false; //only refund if they are in the refund window. - $outstanding_invoice = Invoice::where('subscription_id', $this->subscription->id) + $outstanding_invoice = Invoice::query()->where('subscription_id', $this->subscription->id) ->where('client_id', $recurring_invoice->client_id) ->where('status_id', Invoice::STATUS_PAID) ->where('is_deleted', 0) diff --git a/app/Utils/TemplateEngine.php b/app/Utils/TemplateEngine.php index 09b5ea8b9c5a..a0a1610c6d3f 100644 --- a/app/Utils/TemplateEngine.php +++ b/app/Utils/TemplateEngine.php @@ -98,17 +98,17 @@ class TemplateEngine if (strlen($this->entity) > 1 && strlen($this->entity_id) > 1) { $class = 'App\Models\\' . ucfirst(Str::camel($this->entity)); $this->entity_obj = $class::withTrashed()->where('id', $this->decodePrimaryKey($this->entity_id))->company()->first(); - } elseif (stripos($this->template, 'quote') !== false && $quote = Quote::whereHas('invitations')->withTrashed()->company()->first()) { + } elseif (stripos($this->template, 'quote') !== false && $quote = Quote::query()->whereHas('invitations')->withTrashed()->company()->first()) { $this->entity = 'quote'; $this->entity_obj = $quote; - } elseif (stripos($this->template, 'purchase') !== false && $purchase_order = PurchaseOrder::whereHas('invitations')->withTrashed()->company()->first()) { + } elseif (stripos($this->template, 'purchase') !== false && $purchase_order = PurchaseOrder::query()->whereHas('invitations')->withTrashed()->company()->first()) { $this->entity = 'purchase_order'; $this->entity_obj = $purchase_order; - }elseif (stripos($this->template, 'payment') !== false && $payment = Payment::withTrashed()->company()->first()) { + }elseif (stripos($this->template, 'payment') !== false && $payment = Payment::query()->withTrashed()->company()->first()) { $this->entity = 'payment'; $this->entity_obj = $payment; } - elseif ($invoice = Invoice::whereHas('invitations')->withTrashed()->company()->first()) { + elseif ($invoice = Invoice::query()->whereHas('invitations')->withTrashed()->company()->first()) { $this->entity_obj = $invoice; } else { $this->mockEntity(); diff --git a/database/migrations/2020_09_27_215800_update_gateway_table_visible_column.php b/database/migrations/2020_09_27_215800_update_gateway_table_visible_column.php index a92881cca488..f246f588bf16 100644 --- a/database/migrations/2020_09_27_215800_update_gateway_table_visible_column.php +++ b/database/migrations/2020_09_27_215800_update_gateway_table_visible_column.php @@ -23,7 +23,7 @@ return new class extends Migration { { Gateway::query()->update(['visible' => 0]); - Gateway::whereIn('id', [1, 15, 20, 39])->update(['visible' => 1]); + Gateway::query()->whereIn('id', [1, 15, 20, 39])->update(['visible' => 1]); Schema::table('recurring_invoice_invitations', function ($t) { $t->string('transaction_reference')->nullable(); diff --git a/database/migrations/2020_12_23_220648_remove_null_values_in_countries_table.php b/database/migrations/2020_12_23_220648_remove_null_values_in_countries_table.php index d7c605e661f1..d18acf9b66bb 100644 --- a/database/migrations/2020_12_23_220648_remove_null_values_in_countries_table.php +++ b/database/migrations/2020_12_23_220648_remove_null_values_in_countries_table.php @@ -13,8 +13,8 @@ return new class extends Migration { */ public function up() { - $countries = Country::whereNull('thousand_separator')->update(['thousand_separator' => '']); - $countries = Country::whereNull('decimal_separator')->update(['decimal_separator' => '']); + $countries = Country::query()->whereNull('thousand_separator')->update(['thousand_separator' => '']); + $countries = Country::query()->whereNull('decimal_separator')->update(['decimal_separator' => '']); } /** diff --git a/database/migrations/2021_03_08_205030_add_russian_lang.php b/database/migrations/2021_03_08_205030_add_russian_lang.php index f13e1357068f..24bf0df2607d 100644 --- a/database/migrations/2021_03_08_205030_add_russian_lang.php +++ b/database/migrations/2021_03_08_205030_add_russian_lang.php @@ -23,7 +23,7 @@ return new class extends Migration { $table->integer('default_password_timeout')->default(30); }); - Company::whereNotNull('id')->update(['default_password_timeout' => 30]); + Company::query()->whereNotNull('id')->update(['default_password_timeout' => 30]); } /** diff --git a/database/migrations/2021_04_12_095424_stripe_connect_gateway.php b/database/migrations/2021_04_12_095424_stripe_connect_gateway.php index 8a5dff484542..a53d737ad8d1 100644 --- a/database/migrations/2021_04_12_095424_stripe_connect_gateway.php +++ b/database/migrations/2021_04_12_095424_stripe_connect_gateway.php @@ -27,8 +27,8 @@ return new class extends Migration { Gateway::create($gateway); if (Ninja::isHosted()) { - Gateway::whereIn('id', [20])->update(['visible' => 0]); - Gateway::whereIn('id', [56])->update(['visible' => 1]); + Gateway::query()->whereIn('id', [20])->update(['visible' => 0]); + Gateway::query()->whereIn('id', [56])->update(['visible' => 1]); } } diff --git a/database/migrations/2021_04_22_110240_add_property_to_checkout_gateway_config.php b/database/migrations/2021_04_22_110240_add_property_to_checkout_gateway_config.php index 937dd3bace57..734063651bb8 100644 --- a/database/migrations/2021_04_22_110240_add_property_to_checkout_gateway_config.php +++ b/database/migrations/2021_04_22_110240_add_property_to_checkout_gateway_config.php @@ -15,7 +15,7 @@ return new class extends Migration { */ public function up() { - $gateway = Gateway::where('key', '3758e7f7c6f4cecf0f4f348b9a00f456')->first(); + $gateway = Gateway::query()->where('key', '3758e7f7c6f4cecf0f4f348b9a00f456')->first(); if ($gateway) { $fields = json_decode($gateway->fields); @@ -25,7 +25,7 @@ return new class extends Migration { $gateway->save(); } - CompanyGateway::where('gateway_key', '3758e7f7c6f4cecf0f4f348b9a00f456')->each(function ($checkout) { + CompanyGateway::query()->where('gateway_key', '3758e7f7c6f4cecf0f4f348b9a00f456')->each(function ($checkout) { $config = json_decode(decrypt($checkout->config)); $config->threeds = false; diff --git a/database/migrations/2021_05_03_152940_make_braintree_provider_visible.php b/database/migrations/2021_05_03_152940_make_braintree_provider_visible.php index b4610612d927..20ff447540f2 100644 --- a/database/migrations/2021_05_03_152940_make_braintree_provider_visible.php +++ b/database/migrations/2021_05_03_152940_make_braintree_provider_visible.php @@ -11,7 +11,7 @@ return new class extends Migration { */ public function up() { - Gateway::where('id', 50)->update(['visible' => 1]); + Gateway::query()->where('id', 50)->update(['visible' => 1]); } /** diff --git a/database/migrations/2021_05_05_014713_activate_we_pay.php b/database/migrations/2021_05_05_014713_activate_we_pay.php index ab88783c5ea9..1cbfa10ad1b6 100644 --- a/database/migrations/2021_05_05_014713_activate_we_pay.php +++ b/database/migrations/2021_05_05_014713_activate_we_pay.php @@ -13,7 +13,7 @@ return new class extends Migration { public function up() { if (Gateway::count() >= 1 && Ninja::isHosted()) { - Gateway::whereIn('id', [49])->update(['visible' => true]); + Gateway::query()->whereIn('id', [49])->update(['visible' => true]); } } diff --git a/database/migrations/2021_05_30_100933_make_documents_assigned_user_nullable.php b/database/migrations/2021_05_30_100933_make_documents_assigned_user_nullable.php index b5d6ed974fcc..f2a65b739950 100644 --- a/database/migrations/2021_05_30_100933_make_documents_assigned_user_nullable.php +++ b/database/migrations/2021_05_30_100933_make_documents_assigned_user_nullable.php @@ -18,14 +18,14 @@ return new class extends Migration { $table->unsignedInteger('assigned_user_id')->nullable()->change(); }); - Document::where('assigned_user_id', 0)->update(['assigned_user_id' => null]); + Document::query()->where('assigned_user_id', 0)->update(['assigned_user_id' => null]); if (config('ninja.db.multi_db_enabled')) { foreach (MultiDB::$dbs as $db) { Document::on($db)->where('assigned_user_id', 0)->update(['assigned_user_id' => null]); } } else { - Document::where('assigned_user_id', 0)->update(['assigned_user_id' => null]); + Document::query()->where('assigned_user_id', 0)->update(['assigned_user_id' => null]); } } diff --git a/database/migrations/2021_07_10_085821_activate_payfast_payment_driver.php b/database/migrations/2021_07_10_085821_activate_payfast_payment_driver.php index fb0345a8c37b..f87334dc8e35 100644 --- a/database/migrations/2021_07_10_085821_activate_payfast_payment_driver.php +++ b/database/migrations/2021_07_10_085821_activate_payfast_payment_driver.php @@ -11,7 +11,7 @@ return new class extends Migration { */ public function up() { - Gateway::whereIn('id', [11])->update(['visible' => 1]); + Gateway::query()->whereIn('id', [11])->update(['visible' => 1]); } /** diff --git a/database/migrations/2021_08_05_235942_add_zelle_payment_type.php b/database/migrations/2021_08_05_235942_add_zelle_payment_type.php index 9b88b6d7e9cb..7104b7dbeeb1 100644 --- a/database/migrations/2021_08_05_235942_add_zelle_payment_type.php +++ b/database/migrations/2021_08_05_235942_add_zelle_payment_type.php @@ -14,7 +14,7 @@ return new class extends Migration { { Model::unguard(); - $pt = PaymentType::where('name', 'Zelle')->first(); + $pt = PaymentType::query()->where('name', 'Zelle')->first(); if (! $pt) { $payment_type = new PaymentType(); diff --git a/database/migrations/2021_09_23_100629_add_currencies.php b/database/migrations/2021_09_23_100629_add_currencies.php index 46a8ec71ae94..3e319f8a7198 100644 --- a/database/migrations/2021_09_23_100629_add_currencies.php +++ b/database/migrations/2021_09_23_100629_add_currencies.php @@ -25,7 +25,7 @@ return new class extends Migration { ]; foreach ($currencies as $currency) { - $record = Currency::whereCode($currency['code'])->first(); + $record = Currency::query()->whereCode($currency['code'])->first(); if ($record) { $record->name = $currency['name']; $record->symbol = $currency['symbol']; diff --git a/database/migrations/2021_09_29_190258_add_required_client_registration_fields.php b/database/migrations/2021_09_29_190258_add_required_client_registration_fields.php index ca5cfc71782c..3b2a37765f1e 100644 --- a/database/migrations/2021_09_29_190258_add_required_client_registration_fields.php +++ b/database/migrations/2021_09_29_190258_add_required_client_registration_fields.php @@ -32,7 +32,7 @@ return new class extends Migration { ]; foreach ($currencies as $currency) { - $record = Currency::whereCode($currency['code'])->first(); + $record = Currency::query()->whereCode($currency['code'])->first(); if ($record) { $record->name = $currency['name']; $record->symbol = $currency['symbol']; diff --git a/database/migrations/2022_01_19_232436_add_kyd_currency.php b/database/migrations/2022_01_19_232436_add_kyd_currency.php index ecac6e4dc306..6bd5cb02a252 100644 --- a/database/migrations/2022_01_19_232436_add_kyd_currency.php +++ b/database/migrations/2022_01_19_232436_add_kyd_currency.php @@ -18,7 +18,7 @@ return new class extends Migration { ]; foreach ($currencies as $currency) { - $record = Currency::whereCode($currency['code'])->first(); + $record = Currency::query()->whereCode($currency['code'])->first(); if ($record) { $record->name = $currency['name']; $record->symbol = $currency['symbol']; diff --git a/database/migrations/2022_02_25_015411_update_stripe_apple_domain_config.php b/database/migrations/2022_02_25_015411_update_stripe_apple_domain_config.php index 81d7736510c3..01f04630c9bf 100644 --- a/database/migrations/2022_02_25_015411_update_stripe_apple_domain_config.php +++ b/database/migrations/2022_02_25_015411_update_stripe_apple_domain_config.php @@ -11,7 +11,7 @@ return new class extends Migration { */ public function up() { - CompanyGateway::whereIn('gateway_key', ['d14dd26a47cecc30fdd65700bfb67b34', 'd14dd26a37cecc30fdd65700bfb55b23'])->cursor()->each(function ($cg) { + CompanyGateway::query()->whereIn('gateway_key', ['d14dd26a47cecc30fdd65700bfb67b34', 'd14dd26a37cecc30fdd65700bfb55b23'])->cursor()->each(function ($cg) { $config = $cg->getConfig(); if (! property_exists($config, 'appleDomainVerification')) { diff --git a/database/migrations/2022_09_21_012417_add_threeds_to_braintree.php b/database/migrations/2022_09_21_012417_add_threeds_to_braintree.php index d3f7033b1ca6..af159d264502 100644 --- a/database/migrations/2022_09_21_012417_add_threeds_to_braintree.php +++ b/database/migrations/2022_09_21_012417_add_threeds_to_braintree.php @@ -22,7 +22,7 @@ return new class extends Migration { $g->save(); } - CompanyGateway::where('gateway_key', 'f7ec488676d310683fb51802d076d713')->cursor()->each(function ($cg) { + CompanyGateway::query()->where('gateway_key', 'f7ec488676d310683fb51802d076d713')->cursor()->each(function ($cg) { $config = $cg->getConfig(); $config->threeds = false; $cg->setConfig($config); diff --git a/database/migrations/2022_11_22_215618_lock_tasks_when_invoiced.php b/database/migrations/2022_11_22_215618_lock_tasks_when_invoiced.php index 75b0d655b48b..29bb60d3f649 100644 --- a/database/migrations/2022_11_22_215618_lock_tasks_when_invoiced.php +++ b/database/migrations/2022_11_22_215618_lock_tasks_when_invoiced.php @@ -43,7 +43,7 @@ return new class extends Migration { ]; foreach ($currencies as $currency) { - $record = Currency::whereCode($currency['code'])->first(); + $record = Currency::query()->whereCode($currency['code'])->first(); if ($record) { $record->name = $currency['name']; $record->symbol = $currency['symbol']; diff --git a/database/migrations/2023_03_10_100629_add_currencies.php b/database/migrations/2023_03_10_100629_add_currencies.php index b0a15d6a7d95..5e3be4917375 100644 --- a/database/migrations/2023_03_10_100629_add_currencies.php +++ b/database/migrations/2023_03_10_100629_add_currencies.php @@ -19,7 +19,7 @@ return new class extends Migration { ]; foreach ($currencies as $currency) { - $record = Currency::whereCode($currency['code'])->first(); + $record = Currency::query()->whereCode($currency['code'])->first(); if ($record) { $record->name = $currency['name']; $record->symbol = $currency['symbol']; diff --git a/database/migrations/2023_03_21_053933_tax_calculations_for_invoices.php b/database/migrations/2023_03_21_053933_tax_calculations_for_invoices.php index 76022056235a..8d5d3c1ce798 100644 --- a/database/migrations/2023_03_21_053933_tax_calculations_for_invoices.php +++ b/database/migrations/2023_03_21_053933_tax_calculations_for_invoices.php @@ -42,7 +42,7 @@ return new class extends Migration $table->string('name', 191)->nullable()->change(); }); - CompanyUser::where('is_admin', 0)->cursor()->each(function ($cu) { + CompanyUser::query()->where('is_admin', 0)->cursor()->each(function ($cu) { $permissions = $cu->permissions; if (!$permissions || strlen($permissions) == 0) { diff --git a/database/migrations/2023_07_22_234329_change_currency_format_for_indonesian_rupiah.php b/database/migrations/2023_07_22_234329_change_currency_format_for_indonesian_rupiah.php index c8a1a8abb0c7..20316a338f63 100644 --- a/database/migrations/2023_07_22_234329_change_currency_format_for_indonesian_rupiah.php +++ b/database/migrations/2023_07_22_234329_change_currency_format_for_indonesian_rupiah.php @@ -13,7 +13,7 @@ return new class extends Migration */ public function up() { - $ir = \App\Models\Currency::where('code', 'IDR')->first(); + $ir = \App\Models\Currency::query()->where('code', 'IDR')->first(); if($ir){ $ir->thousand_separator = '.'; diff --git a/database/migrations/2023_08_06_070205_create_view_dashboard_permission_migration.php b/database/migrations/2023_08_06_070205_create_view_dashboard_permission_migration.php index ae8dbe4456d7..472f6b92c5f5 100644 --- a/database/migrations/2023_08_06_070205_create_view_dashboard_permission_migration.php +++ b/database/migrations/2023_08_06_070205_create_view_dashboard_permission_migration.php @@ -13,7 +13,7 @@ return new class extends Migration */ public function up() { - \App\Models\CompanyUser::where('is_admin', 0)->cursor()->each(function ($cu) { + \App\Models\CompanyUser::query()->where('is_admin', 0)->cursor()->each(function ($cu) { $permissions = $cu->permissions; if (!$permissions || strlen($permissions) == 0) { diff --git a/phpstan.neon b/phpstan.neon index 42ed89867698..8e7747dc3a18 100644 --- a/phpstan.neon +++ b/phpstan.neon @@ -17,6 +17,5 @@ parameters: ignoreErrors: - '#Call to an undefined method [a-zA-Z0-9\\_]+::company\(\)#' - '#Call to an undefined method [a-zA-Z0-9\\_]+::entityFilter\(\)#' - - '#Call to an undefined method [a-zA-Z0-9\\_]+::withTrashed\(\)#' - '#Call to an undefined method [a-zA-Z0-9\\_]+::exclude\(\)#' - '#Undefined method#' \ No newline at end of file diff --git a/tests/Feature/BankTransactionApiTest.php b/tests/Feature/BankTransactionApiTest.php index f27aa681f843..a79cd8e50747 100644 --- a/tests/Feature/BankTransactionApiTest.php +++ b/tests/Feature/BankTransactionApiTest.php @@ -147,7 +147,7 @@ class BankTransactionApiTest extends TestCase 'ids' => [$this->encodePrimaryKey($bank_transaction->id)], ]; - nlog($bank_transaction->toArray()); + // nlog($bank_transaction->toArray()); $response = $this->withHeaders([ 'X-API-SECRET' => config('ninja.api_secret'), 'X-API-TOKEN' => $this->token, diff --git a/tests/Feature/ClientTest.php b/tests/Feature/ClientTest.php index 83c84201617a..8fcef3d6c14f 100644 --- a/tests/Feature/ClientTest.php +++ b/tests/Feature/ClientTest.php @@ -113,7 +113,7 @@ class ClientTest extends TestCase $c = $c->fresh(); - nlog($c->contacts->pluck('email')); + // nlog($c->contacts->pluck('email')); $this->assertEquals(4, $c->contacts->count()); diff --git a/tests/Feature/CompanyTest.php b/tests/Feature/CompanyTest.php index af02f493ea4b..6d0fefbc2bf1 100644 --- a/tests/Feature/CompanyTest.php +++ b/tests/Feature/CompanyTest.php @@ -143,7 +143,7 @@ class CompanyTest extends TestCase $company->settings = $settings; - nlog($company->toArray()); + // nlog($company->toArray()); $response = $this->withHeaders([ 'X-API-SECRET' => config('ninja.api_secret'),