mirror of
				https://github.com/invoiceninja/invoiceninja.git
				synced 2025-11-03 22:47:32 -05:00 
			
		
		
		
	Merge pull request #4363 from beganovich/v5-php-cs-fixer
(v5) php-cs-fixer
This commit is contained in:
		
						commit
						c1bb33a042
					
				
							
								
								
									
										18
									
								
								.php_cs
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										18
									
								
								.php_cs
									
									
									
									
									
										Normal file
									
								
							@ -0,0 +1,18 @@
 | 
				
			|||||||
 | 
					<?php
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					$finder = Symfony\Component\Finder\Finder::create()
 | 
				
			||||||
 | 
					    ->notPath('vendor')
 | 
				
			||||||
 | 
					    ->notPath('bootstrap')
 | 
				
			||||||
 | 
					    ->notPath('storage')
 | 
				
			||||||
 | 
					    ->in(__DIR__)
 | 
				
			||||||
 | 
					    ->name('*.php')
 | 
				
			||||||
 | 
					    ->notName('*.blade.php');
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					return PhpCsFixer\Config::create()
 | 
				
			||||||
 | 
					    ->setRules([
 | 
				
			||||||
 | 
					        '@PSR2' => true,
 | 
				
			||||||
 | 
					        'array_syntax' => ['syntax' => 'short'],
 | 
				
			||||||
 | 
					        'ordered_imports' => ['sortAlgorithm' => 'alpha'],
 | 
				
			||||||
 | 
					        'no_unused_imports' => true,
 | 
				
			||||||
 | 
					    ])
 | 
				
			||||||
 | 
					    ->setFinder($finder);
 | 
				
			||||||
@ -12,25 +12,21 @@
 | 
				
			|||||||
namespace App\Console\Commands;
 | 
					namespace App\Console\Commands;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
use App;
 | 
					use App;
 | 
				
			||||||
use App\Libraries\CurlUtils;
 | 
					 | 
				
			||||||
use App\Models\Account;
 | 
					use App\Models\Account;
 | 
				
			||||||
use App\Models\Client;
 | 
					use App\Models\Client;
 | 
				
			||||||
use App\Models\ClientContact;
 | 
					use App\Models\ClientContact;
 | 
				
			||||||
use App\Models\CompanyLedger;
 | 
					use App\Models\CompanyLedger;
 | 
				
			||||||
use App\Models\Contact;
 | 
					use App\Models\Contact;
 | 
				
			||||||
use App\Models\Credit;
 | 
					use App\Models\Credit;
 | 
				
			||||||
use App\Models\Invitation;
 | 
					 | 
				
			||||||
use App\Models\Invoice;
 | 
					use App\Models\Invoice;
 | 
				
			||||||
use App\Models\InvoiceInvitation;
 | 
					use App\Models\InvoiceInvitation;
 | 
				
			||||||
use App\Models\Payment;
 | 
					use App\Models\Payment;
 | 
				
			||||||
use App\Utils\Ninja;
 | 
					use App\Utils\Ninja;
 | 
				
			||||||
use Carbon;
 | 
					 | 
				
			||||||
use DB;
 | 
					use DB;
 | 
				
			||||||
use Exception;
 | 
					use Exception;
 | 
				
			||||||
use Illuminate\Console\Command;
 | 
					use Illuminate\Console\Command;
 | 
				
			||||||
use Mail;
 | 
					use Mail;
 | 
				
			||||||
use Symfony\Component\Console\Input\InputOption;
 | 
					use Symfony\Component\Console\Input\InputOption;
 | 
				
			||||||
use Utils;
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
/*
 | 
					/*
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@ -332,16 +328,16 @@ class CheckData extends Command
 | 
				
			|||||||
                $total_amount = $invoice->payments->where('is_deleted', false)->whereIn('status_id', [Payment::STATUS_COMPLETED, Payment:: STATUS_PENDING, Payment::STATUS_PARTIALLY_REFUNDED])->sum('pivot.amount');
 | 
					                $total_amount = $invoice->payments->where('is_deleted', false)->whereIn('status_id', [Payment::STATUS_COMPLETED, Payment:: STATUS_PENDING, Payment::STATUS_PARTIALLY_REFUNDED])->sum('pivot.amount');
 | 
				
			||||||
                $total_refund = $invoice->payments->where('is_deleted', false)->whereIn('status_id', [Payment::STATUS_COMPLETED, Payment:: STATUS_PENDING, Payment::STATUS_PARTIALLY_REFUNDED])->sum('pivot.refunded');
 | 
					                $total_refund = $invoice->payments->where('is_deleted', false)->whereIn('status_id', [Payment::STATUS_COMPLETED, Payment:: STATUS_PENDING, Payment::STATUS_PARTIALLY_REFUNDED])->sum('pivot.refunded');
 | 
				
			||||||
 | 
					
 | 
				
			||||||
                 $total_invoice_payments += ($total_amount - $total_refund);
 | 
					                $total_invoice_payments += ($total_amount - $total_refund);
 | 
				
			||||||
            }
 | 
					            }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
            foreach($client->payments as $payment)
 | 
					            foreach ($client->payments as $payment) {
 | 
				
			||||||
            {
 | 
					                $credit_total_applied += $payment->paymentables->where('paymentable_type', App\Models\Credit::class)->sum(DB::raw('amount'));
 | 
				
			||||||
              $credit_total_applied += $payment->paymentables->where('paymentable_type', App\Models\Credit::class)->sum(DB::raw('amount'));
 | 
					 | 
				
			||||||
            }
 | 
					            }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
            if($credit_total_applied < 0)
 | 
					            if ($credit_total_applied < 0) {
 | 
				
			||||||
                $total_invoice_payments += $credit_total_applied; //todo this is contentious
 | 
					                $total_invoice_payments += $credit_total_applied;
 | 
				
			||||||
 | 
					            } //todo this is contentious
 | 
				
			||||||
 | 
					
 | 
				
			||||||
            info("total invoice payments = {$total_invoice_payments} with client paid to date of of {$client->paid_to_date}");
 | 
					            info("total invoice payments = {$total_invoice_payments} with client paid to date of of {$client->paid_to_date}");
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
				
			|||||||
@ -12,19 +12,10 @@
 | 
				
			|||||||
namespace App\Console\Commands;
 | 
					namespace App\Console\Commands;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
use App\DataMapper\CompanySettings;
 | 
					use App\DataMapper\CompanySettings;
 | 
				
			||||||
use App\DataMapper\DefaultSettings;
 | 
					 | 
				
			||||||
use App\Events\Invoice\InvoiceWasCreated;
 | 
					use App\Events\Invoice\InvoiceWasCreated;
 | 
				
			||||||
use App\Events\Invoice\InvoiceWasMarkedSent;
 | 
					 | 
				
			||||||
use App\Events\Payment\PaymentWasCreated;
 | 
					 | 
				
			||||||
use App\Factory\ClientFactory;
 | 
					 | 
				
			||||||
use App\Factory\InvoiceFactory;
 | 
					use App\Factory\InvoiceFactory;
 | 
				
			||||||
use App\Factory\InvoiceItemFactory;
 | 
					use App\Factory\InvoiceItemFactory;
 | 
				
			||||||
use App\Factory\PaymentFactory;
 | 
					 | 
				
			||||||
use App\Factory\QuoteFactory;
 | 
					 | 
				
			||||||
use App\Helpers\Invoice\InvoiceSum;
 | 
					use App\Helpers\Invoice\InvoiceSum;
 | 
				
			||||||
use App\Jobs\Quote\CreateQuoteInvitations;
 | 
					 | 
				
			||||||
use App\Listeners\Credit\CreateCreditInvitation;
 | 
					 | 
				
			||||||
use App\Listeners\Invoice\CreateInvoiceInvitation;
 | 
					 | 
				
			||||||
use App\Models\Account;
 | 
					use App\Models\Account;
 | 
				
			||||||
use App\Models\Client;
 | 
					use App\Models\Client;
 | 
				
			||||||
use App\Models\ClientContact;
 | 
					use App\Models\ClientContact;
 | 
				
			||||||
@ -34,8 +25,6 @@ use App\Models\CompanyToken;
 | 
				
			|||||||
use App\Models\Country;
 | 
					use App\Models\Country;
 | 
				
			||||||
use App\Models\Credit;
 | 
					use App\Models\Credit;
 | 
				
			||||||
use App\Models\Expense;
 | 
					use App\Models\Expense;
 | 
				
			||||||
use App\Models\Payment;
 | 
					 | 
				
			||||||
use App\Models\PaymentType;
 | 
					 | 
				
			||||||
use App\Models\Product;
 | 
					use App\Models\Product;
 | 
				
			||||||
use App\Models\Project;
 | 
					use App\Models\Project;
 | 
				
			||||||
use App\Models\Quote;
 | 
					use App\Models\Quote;
 | 
				
			||||||
@ -100,7 +89,6 @@ class CreateSingleAccount extends Command
 | 
				
			|||||||
        $this->warmCache();
 | 
					        $this->warmCache();
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        $this->createSmallAccount();
 | 
					        $this->createSmallAccount();
 | 
				
			||||||
 | 
					 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    private function createSmallAccount()
 | 
					    private function createSmallAccount()
 | 
				
			||||||
@ -205,7 +193,6 @@ class CreateSingleAccount extends Command
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
            $this->info('creating credit for client #'.$client->id);
 | 
					            $this->info('creating credit for client #'.$client->id);
 | 
				
			||||||
            $this->createCredit($client);
 | 
					            $this->createCredit($client);
 | 
				
			||||||
 | 
					 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        $this->createGateways($company, $user);
 | 
					        $this->createGateways($company, $user);
 | 
				
			||||||
@ -299,7 +286,6 @@ class CreateSingleAccount extends Command
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
    private function createInvoice($client)
 | 
					    private function createInvoice($client)
 | 
				
			||||||
    {
 | 
					    {
 | 
				
			||||||
 | 
					 | 
				
			||||||
        $faker = Factory::create();
 | 
					        $faker = Factory::create();
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        $invoice = InvoiceFactory::create($client->company->id, $client->user->id); //stub the company and user_id
 | 
					        $invoice = InvoiceFactory::create($client->company->id, $client->user->id); //stub the company and user_id
 | 
				
			||||||
@ -369,7 +355,6 @@ class CreateSingleAccount extends Command
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
    private function createQuote($client)
 | 
					    private function createQuote($client)
 | 
				
			||||||
    {
 | 
					    {
 | 
				
			||||||
 | 
					 | 
				
			||||||
        $faker = Factory::create();
 | 
					        $faker = Factory::create();
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        $quote = Quote::factory()->create(['user_id' => $client->user->id, 'company_id' => $client->company->id, 'client_id' => $client->id]);
 | 
					        $quote = Quote::factory()->create(['user_id' => $client->user->id, 'company_id' => $client->company->id, 'client_id' => $client->id]);
 | 
				
			||||||
@ -414,21 +399,21 @@ class CreateSingleAccount extends Command
 | 
				
			|||||||
    {
 | 
					    {
 | 
				
			||||||
        $line_items = [];
 | 
					        $line_items = [];
 | 
				
			||||||
 | 
					
 | 
				
			||||||
            $item = InvoiceItemFactory::create();
 | 
					        $item = InvoiceItemFactory::create();
 | 
				
			||||||
            $item->quantity = 1;
 | 
					        $item->quantity = 1;
 | 
				
			||||||
            $item->cost = 1000;
 | 
					        $item->cost = 1000;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
            $product = Product::all()->random();
 | 
					        $product = Product::all()->random();
 | 
				
			||||||
 | 
					
 | 
				
			||||||
            $item->cost = (float) $product->cost;
 | 
					        $item->cost = (float) $product->cost;
 | 
				
			||||||
            $item->product_key = $product->product_key;
 | 
					        $item->product_key = $product->product_key;
 | 
				
			||||||
            $item->notes = $product->notes;
 | 
					        $item->notes = $product->notes;
 | 
				
			||||||
            $item->custom_value1 = $product->custom_value1;
 | 
					        $item->custom_value1 = $product->custom_value1;
 | 
				
			||||||
            $item->custom_value2 = $product->custom_value2;
 | 
					        $item->custom_value2 = $product->custom_value2;
 | 
				
			||||||
            $item->custom_value3 = $product->custom_value3;
 | 
					        $item->custom_value3 = $product->custom_value3;
 | 
				
			||||||
            $item->custom_value4 = $product->custom_value4;
 | 
					        $item->custom_value4 = $product->custom_value4;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
            $line_items[] = $item;
 | 
					        $line_items[] = $item;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        return $line_items;
 | 
					        return $line_items;
 | 
				
			||||||
@ -505,7 +490,6 @@ class CreateSingleAccount extends Command
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
    private function createGateways($company, $user)
 | 
					    private function createGateways($company, $user)
 | 
				
			||||||
    {
 | 
					    {
 | 
				
			||||||
 | 
					 | 
				
			||||||
        if (config('ninja.testvars.stripe') && ($this->gateway == 'all' || $this->gateway == 'stripe')) {
 | 
					        if (config('ninja.testvars.stripe') && ($this->gateway == 'all' || $this->gateway == 'stripe')) {
 | 
				
			||||||
            $cg = new CompanyGateway;
 | 
					            $cg = new CompanyGateway;
 | 
				
			||||||
            $cg->company_id = $company->id;
 | 
					            $cg->company_id = $company->id;
 | 
				
			||||||
 | 
				
			|||||||
@ -12,29 +12,19 @@
 | 
				
			|||||||
namespace App\Console\Commands;
 | 
					namespace App\Console\Commands;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
use App\DataMapper\CompanySettings;
 | 
					use App\DataMapper\CompanySettings;
 | 
				
			||||||
use App\DataMapper\DefaultSettings;
 | 
					 | 
				
			||||||
use App\Events\Invoice\InvoiceWasCreated;
 | 
					use App\Events\Invoice\InvoiceWasCreated;
 | 
				
			||||||
use App\Events\Invoice\InvoiceWasMarkedSent;
 | 
					 | 
				
			||||||
use App\Events\Payment\PaymentWasCreated;
 | 
					 | 
				
			||||||
use App\Factory\ClientFactory;
 | 
					 | 
				
			||||||
use App\Factory\InvoiceFactory;
 | 
					use App\Factory\InvoiceFactory;
 | 
				
			||||||
use App\Factory\InvoiceItemFactory;
 | 
					use App\Factory\InvoiceItemFactory;
 | 
				
			||||||
use App\Factory\PaymentFactory;
 | 
					 | 
				
			||||||
use App\Factory\QuoteFactory;
 | 
					use App\Factory\QuoteFactory;
 | 
				
			||||||
use App\Helpers\Invoice\InvoiceSum;
 | 
					use App\Helpers\Invoice\InvoiceSum;
 | 
				
			||||||
use App\Jobs\Quote\CreateQuoteInvitations;
 | 
					 | 
				
			||||||
use App\Listeners\Credit\CreateCreditInvitation;
 | 
					 | 
				
			||||||
use App\Listeners\Invoice\CreateInvoiceInvitation;
 | 
					 | 
				
			||||||
use App\Models\Account;
 | 
					use App\Models\Account;
 | 
				
			||||||
use App\Models\Client;
 | 
					use App\Models\Client;
 | 
				
			||||||
use App\Models\ClientContact;
 | 
					use App\Models\ClientContact;
 | 
				
			||||||
use App\Models\Company;
 | 
					use App\Models\Company;
 | 
				
			||||||
use App\Models\CompanyToken;
 | 
					use App\Models\CompanyToken;
 | 
				
			||||||
use App\Models\Credit;
 | 
					 | 
				
			||||||
use App\Models\Country;
 | 
					use App\Models\Country;
 | 
				
			||||||
 | 
					use App\Models\Credit;
 | 
				
			||||||
use App\Models\Expense;
 | 
					use App\Models\Expense;
 | 
				
			||||||
use App\Models\Payment;
 | 
					 | 
				
			||||||
use App\Models\PaymentType;
 | 
					 | 
				
			||||||
use App\Models\Product;
 | 
					use App\Models\Product;
 | 
				
			||||||
use App\Models\Project;
 | 
					use App\Models\Project;
 | 
				
			||||||
use App\Models\Quote;
 | 
					use App\Models\Quote;
 | 
				
			||||||
@ -471,7 +461,6 @@ class CreateTestData extends Command
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
    private function createInvoice($client)
 | 
					    private function createInvoice($client)
 | 
				
			||||||
    {
 | 
					    {
 | 
				
			||||||
 | 
					 | 
				
			||||||
        $faker = Factory::create();
 | 
					        $faker = Factory::create();
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        $invoice = InvoiceFactory::create($client->company->id, $client->user->id); //stub the company and user_id
 | 
					        $invoice = InvoiceFactory::create($client->company->id, $client->user->id); //stub the company and user_id
 | 
				
			||||||
@ -522,7 +511,6 @@ class CreateTestData extends Command
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
    private function createCredit($client)
 | 
					    private function createCredit($client)
 | 
				
			||||||
    {
 | 
					    {
 | 
				
			||||||
 | 
					 | 
				
			||||||
        $faker = Factory::create();
 | 
					        $faker = Factory::create();
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        $credit = Credit::factory()->create(['user_id' => $client->user->id, 'company_id' => $client->company->id, 'client_id' => $client->id]);
 | 
					        $credit = Credit::factory()->create(['user_id' => $client->user->id, 'company_id' => $client->company->id, 'client_id' => $client->id]);
 | 
				
			||||||
@ -562,7 +550,6 @@ class CreateTestData extends Command
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
    private function createQuote($client)
 | 
					    private function createQuote($client)
 | 
				
			||||||
    {
 | 
					    {
 | 
				
			||||||
 | 
					 | 
				
			||||||
        $faker = Factory::create();
 | 
					        $faker = Factory::create();
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        //$quote = QuoteFactory::create($client->company->id, $client->user->id);//stub the company and user_id
 | 
					        //$quote = QuoteFactory::create($client->company->id, $client->user->id);//stub the company and user_id
 | 
				
			||||||
 | 
				
			|||||||
@ -25,7 +25,6 @@ use App\Models\Client;
 | 
				
			|||||||
use App\Models\ClientContact;
 | 
					use App\Models\ClientContact;
 | 
				
			||||||
use App\Models\Company;
 | 
					use App\Models\Company;
 | 
				
			||||||
use App\Models\CompanyToken;
 | 
					use App\Models\CompanyToken;
 | 
				
			||||||
use App\Models\Country;
 | 
					 | 
				
			||||||
use App\Models\Credit;
 | 
					use App\Models\Credit;
 | 
				
			||||||
use App\Models\Expense;
 | 
					use App\Models\Expense;
 | 
				
			||||||
use App\Models\Product;
 | 
					use App\Models\Product;
 | 
				
			||||||
@ -40,18 +39,12 @@ use App\Utils\Ninja;
 | 
				
			|||||||
use App\Utils\Traits\GeneratesCounter;
 | 
					use App\Utils\Traits\GeneratesCounter;
 | 
				
			||||||
use App\Utils\Traits\MakesHash;
 | 
					use App\Utils\Traits\MakesHash;
 | 
				
			||||||
use Carbon\Carbon;
 | 
					use Carbon\Carbon;
 | 
				
			||||||
use Composer\Composer;
 | 
					 | 
				
			||||||
use Composer\Console\Application;
 | 
					 | 
				
			||||||
use Composer\Factory;
 | 
					 | 
				
			||||||
use Composer\IO\NullIO;
 | 
					 | 
				
			||||||
use Composer\Installer;
 | 
					 | 
				
			||||||
use Illuminate\Console\Command;
 | 
					use Illuminate\Console\Command;
 | 
				
			||||||
use Illuminate\Support\Facades\Artisan;
 | 
					use Illuminate\Support\Facades\Artisan;
 | 
				
			||||||
use Illuminate\Support\Facades\Cache;
 | 
					use Illuminate\Support\Facades\Cache;
 | 
				
			||||||
use Illuminate\Support\Facades\Hash;
 | 
					use Illuminate\Support\Facades\Hash;
 | 
				
			||||||
use Illuminate\Support\Facades\Schema;
 | 
					use Illuminate\Support\Facades\Schema;
 | 
				
			||||||
use Illuminate\Support\Str;
 | 
					use Illuminate\Support\Str;
 | 
				
			||||||
use Symfony\Component\Console\Input\ArrayInput;
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
class DemoMode extends Command
 | 
					class DemoMode extends Command
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
@ -303,7 +296,7 @@ class DemoMode extends Command
 | 
				
			|||||||
                    'is_primary' => 1,
 | 
					                    'is_primary' => 1,
 | 
				
			||||||
                ]);
 | 
					                ]);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        ClientContact::factory()->count(rand(1,5))->create([
 | 
					        ClientContact::factory()->count(rand(1, 5))->create([
 | 
				
			||||||
                    'user_id' => $user->id,
 | 
					                    'user_id' => $user->id,
 | 
				
			||||||
                    'client_id' => $client->id,
 | 
					                    'client_id' => $client->id,
 | 
				
			||||||
                    'company_id' => $company->id,
 | 
					                    'company_id' => $company->id,
 | 
				
			||||||
@ -325,7 +318,7 @@ class DemoMode extends Command
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
    private function createExpense($client)
 | 
					    private function createExpense($client)
 | 
				
			||||||
    {
 | 
					    {
 | 
				
			||||||
        Expense::factory()->count(rand(1,5))->create([
 | 
					        Expense::factory()->count(rand(1, 5))->create([
 | 
				
			||||||
                'user_id' => $client->user_id,
 | 
					                'user_id' => $client->user_id,
 | 
				
			||||||
                'client_id' => $client->id,
 | 
					                'client_id' => $client->id,
 | 
				
			||||||
                'company_id' => $client->company_id,
 | 
					                'company_id' => $client->company_id,
 | 
				
			||||||
@ -346,7 +339,7 @@ class DemoMode extends Command
 | 
				
			|||||||
                'is_primary' => 1,
 | 
					                'is_primary' => 1,
 | 
				
			||||||
            ]);
 | 
					            ]);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        VendorContact::factory()->count(rand(1,5))->create([
 | 
					        VendorContact::factory()->count(rand(1, 5))->create([
 | 
				
			||||||
                'user_id' => $client->user->id,
 | 
					                'user_id' => $client->user->id,
 | 
				
			||||||
                'vendor_id' => $vendor->id,
 | 
					                'vendor_id' => $vendor->id,
 | 
				
			||||||
                'company_id' => $client->company_id,
 | 
					                'company_id' => $client->company_id,
 | 
				
			||||||
@ -376,7 +369,6 @@ class DemoMode extends Command
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
    private function createInvoice($client, $assigned_user_id = null)
 | 
					    private function createInvoice($client, $assigned_user_id = null)
 | 
				
			||||||
    {
 | 
					    {
 | 
				
			||||||
 | 
					 | 
				
			||||||
        $faker = \Faker\Factory::create();
 | 
					        $faker = \Faker\Factory::create();
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        $invoice = InvoiceFactory::create($client->company->id, $client->user->id); //stub the company and user_id
 | 
					        $invoice = InvoiceFactory::create($client->company->id, $client->user->id); //stub the company and user_id
 | 
				
			||||||
@ -441,7 +433,6 @@ class DemoMode extends Command
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
    private function createCredit($client, $assigned_user_id = null)
 | 
					    private function createCredit($client, $assigned_user_id = null)
 | 
				
			||||||
    {
 | 
					    {
 | 
				
			||||||
 | 
					 | 
				
			||||||
        $faker = \Faker\Factory::create();
 | 
					        $faker = \Faker\Factory::create();
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        $credit = Credit::factory()->create(['user_id' => $client->user->id, 'company_id' => $client->company->id, 'client_id' => $client->id]);
 | 
					        $credit = Credit::factory()->create(['user_id' => $client->user->id, 'company_id' => $client->company->id, 'client_id' => $client->id]);
 | 
				
			||||||
 | 
				
			|||||||
@ -11,11 +11,7 @@
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
namespace App\Console\Commands;
 | 
					namespace App\Console\Commands;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
use Composer\Composer;
 | 
					 | 
				
			||||||
use Composer\Console\Application;
 | 
					use Composer\Console\Application;
 | 
				
			||||||
use Composer\Factory;
 | 
					 | 
				
			||||||
use Composer\Installer;
 | 
					 | 
				
			||||||
use Composer\IO\NullIO;
 | 
					 | 
				
			||||||
use Illuminate\Console\Command;
 | 
					use Illuminate\Console\Command;
 | 
				
			||||||
use Illuminate\Support\Facades\Artisan;
 | 
					use Illuminate\Support\Facades\Artisan;
 | 
				
			||||||
use Log;
 | 
					use Log;
 | 
				
			||||||
@ -46,7 +42,6 @@ class PostUpdate extends Command
 | 
				
			|||||||
     */
 | 
					     */
 | 
				
			||||||
    public function handle()
 | 
					    public function handle()
 | 
				
			||||||
    {
 | 
					    {
 | 
				
			||||||
 | 
					 | 
				
			||||||
        set_time_limit(0);
 | 
					        set_time_limit(0);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        info('running post update');
 | 
					        info('running post update');
 | 
				
			||||||
@ -67,12 +62,11 @@ class PostUpdate extends Command
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
        putenv('COMPOSER_HOME=' . __DIR__ . '/vendor/bin/composer');
 | 
					        putenv('COMPOSER_HOME=' . __DIR__ . '/vendor/bin/composer');
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        $input = new ArrayInput(array('command' => 'install', '--no-dev' => 'true'));
 | 
					        $input = new ArrayInput(['command' => 'install', '--no-dev' => 'true']);
 | 
				
			||||||
        $application = new Application();
 | 
					        $application = new Application();
 | 
				
			||||||
        $application->setAutoExit(false);
 | 
					        $application->setAutoExit(false);
 | 
				
			||||||
        $application->run($input);
 | 
					        $application->run($input);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        echo "Done.";
 | 
					        echo "Done.";
 | 
				
			||||||
 | 
					 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
				
			|||||||
@ -12,7 +12,6 @@
 | 
				
			|||||||
namespace App\Console\Commands;
 | 
					namespace App\Console\Commands;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
use App\Jobs\Cron\RecurringInvoicesCron;
 | 
					use App\Jobs\Cron\RecurringInvoicesCron;
 | 
				
			||||||
use App\Models\Design;
 | 
					 | 
				
			||||||
use Illuminate\Console\Command;
 | 
					use Illuminate\Console\Command;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
class RecurringCommand extends Command
 | 
					class RecurringCommand extends Command
 | 
				
			||||||
 | 
				
			|||||||
@ -65,10 +65,9 @@ class SendRemindersCron extends Command
 | 
				
			|||||||
                          ->whereDate('due_date', now()->subDays(1)->startOfDay())
 | 
					                          ->whereDate('due_date', now()->subDays(1)->startOfDay())
 | 
				
			||||||
                          ->cursor();
 | 
					                          ->cursor();
 | 
				
			||||||
    
 | 
					    
 | 
				
			||||||
        $invoices->each(function ($invoice){
 | 
					        $invoices->each(function ($invoice) {
 | 
				
			||||||
            WebHookHandler::dispatch(Webhook::EVENT_LATE_INVOICE, $invoice, $invoice->company);
 | 
					            WebHookHandler::dispatch(Webhook::EVENT_LATE_INVOICE, $invoice, $invoice->company);
 | 
				
			||||||
        });
 | 
					        });
 | 
				
			||||||
 | 
					 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    private function webHookExpiredQuotes()
 | 
					    private function webHookExpiredQuotes()
 | 
				
			||||||
@ -78,7 +77,7 @@ class SendRemindersCron extends Command
 | 
				
			|||||||
                          ->whereDate('due_date', now()->subDays(1)->startOfDay())
 | 
					                          ->whereDate('due_date', now()->subDays(1)->startOfDay())
 | 
				
			||||||
                          ->cursor();
 | 
					                          ->cursor();
 | 
				
			||||||
    
 | 
					    
 | 
				
			||||||
        $quotes->each(function ($quote){
 | 
					        $quotes->each(function ($quote) {
 | 
				
			||||||
            WebHookHandler::dispatch(Webhook::EVENT_EXPIRED_QUOTE, $quote, $quote->company);
 | 
					            WebHookHandler::dispatch(Webhook::EVENT_EXPIRED_QUOTE, $quote, $quote->company);
 | 
				
			||||||
        });
 | 
					        });
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
				
			|||||||
@ -14,7 +14,6 @@ namespace App\Console\Commands;
 | 
				
			|||||||
use App\DataMapper\CompanySettings;
 | 
					use App\DataMapper\CompanySettings;
 | 
				
			||||||
use App\DataMapper\DefaultSettings;
 | 
					use App\DataMapper\DefaultSettings;
 | 
				
			||||||
use App\Factory\ClientFactory;
 | 
					use App\Factory\ClientFactory;
 | 
				
			||||||
use App\Factory\CompanyUserFactory;
 | 
					 | 
				
			||||||
use App\Factory\InvoiceFactory;
 | 
					use App\Factory\InvoiceFactory;
 | 
				
			||||||
use App\Factory\InvoiceInvitationFactory;
 | 
					use App\Factory\InvoiceInvitationFactory;
 | 
				
			||||||
use App\Jobs\Invoice\CreateEntityPdf;
 | 
					use App\Jobs\Invoice\CreateEntityPdf;
 | 
				
			||||||
@ -23,11 +22,9 @@ use App\Models\Account;
 | 
				
			|||||||
use App\Models\Client;
 | 
					use App\Models\Client;
 | 
				
			||||||
use App\Models\ClientContact;
 | 
					use App\Models\ClientContact;
 | 
				
			||||||
use App\Models\Company;
 | 
					use App\Models\Company;
 | 
				
			||||||
use App\Models\Invoice;
 | 
					 | 
				
			||||||
use App\Models\User;
 | 
					use App\Models\User;
 | 
				
			||||||
use Faker\Factory;
 | 
					use Faker\Factory;
 | 
				
			||||||
use Illuminate\Console\Command;
 | 
					use Illuminate\Console\Command;
 | 
				
			||||||
use Illuminate\Support\Carbon;
 | 
					 | 
				
			||||||
use Illuminate\Support\Facades\Mail;
 | 
					use Illuminate\Support\Facades\Mail;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
class SendTestEmails extends Command
 | 
					class SendTestEmails extends Command
 | 
				
			||||||
@ -82,7 +79,6 @@ class SendTestEmails extends Command
 | 
				
			|||||||
        $user = User::whereEmail('user@example.com')->first();
 | 
					        $user = User::whereEmail('user@example.com')->first();
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        if (! $user) {
 | 
					        if (! $user) {
 | 
				
			||||||
 | 
					 | 
				
			||||||
            $account = Account::factory()->create();
 | 
					            $account = Account::factory()->create();
 | 
				
			||||||
 | 
					
 | 
				
			||||||
            $user = User::factory()->create([
 | 
					            $user = User::factory()->create([
 | 
				
			||||||
 | 
				
			|||||||
@ -11,10 +11,8 @@
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
namespace App\Console;
 | 
					namespace App\Console;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
use App\Console\Commands\CheckData;
 | 
					 | 
				
			||||||
use App\Jobs\Cron\RecurringInvoicesCron;
 | 
					use App\Jobs\Cron\RecurringInvoicesCron;
 | 
				
			||||||
use App\Jobs\Ninja\AdjustEmailQuota;
 | 
					use App\Jobs\Ninja\AdjustEmailQuota;
 | 
				
			||||||
use App\Jobs\Ninja\CheckDbStatus;
 | 
					 | 
				
			||||||
use App\Jobs\Ninja\CompanySizeCheck;
 | 
					use App\Jobs\Ninja\CompanySizeCheck;
 | 
				
			||||||
use App\Jobs\Util\ReminderJob;
 | 
					use App\Jobs\Util\ReminderJob;
 | 
				
			||||||
use App\Jobs\Util\SendFailedEmails;
 | 
					use App\Jobs\Util\SendFailedEmails;
 | 
				
			||||||
 | 
				
			|||||||
@ -11,10 +11,7 @@
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
namespace App\DataMapper;
 | 
					namespace App\DataMapper;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
use App\DataMapper\ClientSettings;
 | 
					 | 
				
			||||||
use App\DataMapper\CompanySettings;
 | 
					 | 
				
			||||||
use App\Models\Client;
 | 
					use App\Models\Client;
 | 
				
			||||||
use App\Utils\TranslationHelper;
 | 
					 | 
				
			||||||
use stdClass;
 | 
					use stdClass;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
/**
 | 
					/**
 | 
				
			||||||
 | 
				
			|||||||
@ -175,13 +175,13 @@ class CompanySettings extends BaseSettings
 | 
				
			|||||||
    public $email_template_reminder3 = ''; //@implemented
 | 
					    public $email_template_reminder3 = ''; //@implemented
 | 
				
			||||||
    public $email_template_reminder_endless = ''; //@implemented
 | 
					    public $email_template_reminder_endless = ''; //@implemented
 | 
				
			||||||
    public $email_signature = ''; //@implemented
 | 
					    public $email_signature = ''; //@implemented
 | 
				
			||||||
    public $enable_email_markup = true; //@TODO - 
 | 
					    public $enable_email_markup = true; //@TODO -
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    public $email_subject_custom1 = ''; //@TODO
 | 
					    public $email_subject_custom1 = ''; //@TODO
 | 
				
			||||||
    public $email_subject_custom2 = ''; //@TODO
 | 
					    public $email_subject_custom2 = ''; //@TODO
 | 
				
			||||||
    public $email_subject_custom3 = ''; //@TODO
 | 
					    public $email_subject_custom3 = ''; //@TODO
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    public $email_template_custom1 = ''; //@TODO 
 | 
					    public $email_template_custom1 = ''; //@TODO
 | 
				
			||||||
    public $email_template_custom2 = ''; //@TODO
 | 
					    public $email_template_custom2 = ''; //@TODO
 | 
				
			||||||
    public $email_template_custom3 = ''; //@TODO
 | 
					    public $email_template_custom3 = ''; //@TODO
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@ -195,7 +195,7 @@ class CompanySettings extends BaseSettings
 | 
				
			|||||||
    public $num_days_reminder3 = 0;//@implmemented
 | 
					    public $num_days_reminder3 = 0;//@implmemented
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    public $schedule_reminder1 = ''; // (enum: after_invoice_date, before_due_date, after_due_date) implmemented
 | 
					    public $schedule_reminder1 = ''; // (enum: after_invoice_date, before_due_date, after_due_date) implmemented
 | 
				
			||||||
    public $schedule_reminder2 = ''; // (enum: after_invoice_date, before_due_date, after_due_date) implmemented 
 | 
					    public $schedule_reminder2 = ''; // (enum: after_invoice_date, before_due_date, after_due_date) implmemented
 | 
				
			||||||
    public $schedule_reminder3 = ''; // (enum: after_invoice_date, before_due_date, after_due_date) implmemented
 | 
					    public $schedule_reminder3 = ''; // (enum: after_invoice_date, before_due_date, after_due_date) implmemented
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    public $reminder_send_time = 32400; //number of seconds from UTC +0 to send reminders @TODO
 | 
					    public $reminder_send_time = 32400; //number of seconds from UTC +0 to send reminders @TODO
 | 
				
			||||||
@ -511,7 +511,7 @@ class CompanySettings extends BaseSettings
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
    /**
 | 
					    /**
 | 
				
			||||||
     * Provides class defaults on init.
 | 
					     * Provides class defaults on init.
 | 
				
			||||||
     * 
 | 
					     *
 | 
				
			||||||
     * @return stdClass
 | 
					     * @return stdClass
 | 
				
			||||||
     */
 | 
					     */
 | 
				
			||||||
    public static function defaults(): stdClass
 | 
					    public static function defaults(): stdClass
 | 
				
			||||||
@ -544,7 +544,7 @@ class CompanySettings extends BaseSettings
 | 
				
			|||||||
     * set new properties to the object prior to being returned.
 | 
					     * set new properties to the object prior to being returned.
 | 
				
			||||||
     *
 | 
					     *
 | 
				
			||||||
     * @param $settings
 | 
					     * @param $settings
 | 
				
			||||||
     * 
 | 
					     *
 | 
				
			||||||
     * @return stdClass
 | 
					     * @return stdClass
 | 
				
			||||||
     */
 | 
					     */
 | 
				
			||||||
    public static function setProperties($settings): stdClass
 | 
					    public static function setProperties($settings): stdClass
 | 
				
			||||||
@ -562,7 +562,7 @@ class CompanySettings extends BaseSettings
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
    /**
 | 
					    /**
 | 
				
			||||||
     * Stubs the notification defaults
 | 
					     * Stubs the notification defaults
 | 
				
			||||||
     * 
 | 
					     *
 | 
				
			||||||
     * @return stdClass
 | 
					     * @return stdClass
 | 
				
			||||||
     */
 | 
					     */
 | 
				
			||||||
    public static function notificationDefaults() :stdClass
 | 
					    public static function notificationDefaults() :stdClass
 | 
				
			||||||
@ -575,7 +575,7 @@ class CompanySettings extends BaseSettings
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
    /**
 | 
					    /**
 | 
				
			||||||
     * Defines entity variables for PDF generation
 | 
					     * Defines entity variables for PDF generation
 | 
				
			||||||
     * 
 | 
					     *
 | 
				
			||||||
     * @return stdClass The stdClass of PDF variables
 | 
					     * @return stdClass The stdClass of PDF variables
 | 
				
			||||||
     */
 | 
					     */
 | 
				
			||||||
    private static function getEntityVariableDefaults() :stdClass
 | 
					    private static function getEntityVariableDefaults() :stdClass
 | 
				
			||||||
 | 
				
			|||||||
@ -11,7 +11,6 @@
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
namespace App\DataMapper;
 | 
					namespace App\DataMapper;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
use App\Models\Client;
 | 
					 | 
				
			||||||
use App\Models\User;
 | 
					use App\Models\User;
 | 
				
			||||||
use stdClass;
 | 
					use stdClass;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
				
			|||||||
@ -12,7 +12,6 @@
 | 
				
			|||||||
namespace App\DataMapper;
 | 
					namespace App\DataMapper;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
use Illuminate\Support\Facades\App;
 | 
					use Illuminate\Support\Facades\App;
 | 
				
			||||||
use League\CommonMark\CommonMarkConverter;
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
class EmailTemplateDefaults
 | 
					class EmailTemplateDefaults
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
@ -148,11 +147,9 @@ class EmailTemplateDefaults
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
    public static function emailPaymentTemplate()
 | 
					    public static function emailPaymentTemplate()
 | 
				
			||||||
    {
 | 
					    {
 | 
				
			||||||
 | 
					 | 
				
			||||||
        $payment_message = '<p>'.self::transformText('payment_message').'</p><br><br><p>$view_link</p>';
 | 
					        $payment_message = '<p>'.self::transformText('payment_message').'</p><br><br><p>$view_link</p>';
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        return $payment_message;
 | 
					        return $payment_message;
 | 
				
			||||||
 | 
					 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    public static function emailCreditTemplate()
 | 
					    public static function emailCreditTemplate()
 | 
				
			||||||
@ -164,11 +161,9 @@ class EmailTemplateDefaults
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
    public static function emailPaymentPartialTemplate()
 | 
					    public static function emailPaymentPartialTemplate()
 | 
				
			||||||
    {
 | 
					    {
 | 
				
			||||||
 | 
					 | 
				
			||||||
        $payment_message = '<p>'.self::transformText('payment_message').'</p><br><br><p>$view_link</p>';
 | 
					        $payment_message = '<p>'.self::transformText('payment_message').'</p><br><br><p>$view_link</p>';
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        return $payment_message;
 | 
					        return $payment_message;
 | 
				
			||||||
 | 
					 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    public static function emailPaymentPartialSubject()
 | 
					    public static function emailPaymentPartialSubject()
 | 
				
			||||||
 | 
				
			|||||||
@ -11,7 +11,6 @@
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
namespace App\DataMapper;
 | 
					namespace App\DataMapper;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
use App\DataMapper\CompanySettings;
 | 
					 | 
				
			||||||
use App\Utils\Traits\MakesHash;
 | 
					use App\Utils\Traits\MakesHash;
 | 
				
			||||||
use stdClass;
 | 
					use stdClass;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
				
			|||||||
@ -13,9 +13,7 @@ namespace App\Events\Account;
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
use Illuminate\Broadcasting\Channel;
 | 
					use Illuminate\Broadcasting\Channel;
 | 
				
			||||||
use Illuminate\Broadcasting\InteractsWithSockets;
 | 
					use Illuminate\Broadcasting\InteractsWithSockets;
 | 
				
			||||||
use Illuminate\Broadcasting\PresenceChannel;
 | 
					 | 
				
			||||||
use Illuminate\Broadcasting\PrivateChannel;
 | 
					use Illuminate\Broadcasting\PrivateChannel;
 | 
				
			||||||
use Illuminate\Contracts\Broadcasting\ShouldBroadcast;
 | 
					 | 
				
			||||||
use Illuminate\Foundation\Events\Dispatchable;
 | 
					use Illuminate\Foundation\Events\Dispatchable;
 | 
				
			||||||
use Illuminate\Queue\SerializesModels;
 | 
					use Illuminate\Queue\SerializesModels;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
				
			|||||||
@ -15,9 +15,7 @@ use App\Models\Client;
 | 
				
			|||||||
use App\Models\Company;
 | 
					use App\Models\Company;
 | 
				
			||||||
use Illuminate\Broadcasting\Channel;
 | 
					use Illuminate\Broadcasting\Channel;
 | 
				
			||||||
use Illuminate\Broadcasting\InteractsWithSockets;
 | 
					use Illuminate\Broadcasting\InteractsWithSockets;
 | 
				
			||||||
use Illuminate\Broadcasting\PresenceChannel;
 | 
					 | 
				
			||||||
use Illuminate\Broadcasting\PrivateChannel;
 | 
					use Illuminate\Broadcasting\PrivateChannel;
 | 
				
			||||||
use Illuminate\Contracts\Broadcasting\ShouldBroadcast;
 | 
					 | 
				
			||||||
use Illuminate\Foundation\Events\Dispatchable;
 | 
					use Illuminate\Foundation\Events\Dispatchable;
 | 
				
			||||||
use Illuminate\Queue\SerializesModels;
 | 
					use Illuminate\Queue\SerializesModels;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
				
			|||||||
@ -14,9 +14,7 @@ namespace App\Events\Company;
 | 
				
			|||||||
use App\Models\Company;
 | 
					use App\Models\Company;
 | 
				
			||||||
use Illuminate\Broadcasting\Channel;
 | 
					use Illuminate\Broadcasting\Channel;
 | 
				
			||||||
use Illuminate\Broadcasting\InteractsWithSockets;
 | 
					use Illuminate\Broadcasting\InteractsWithSockets;
 | 
				
			||||||
use Illuminate\Broadcasting\PresenceChannel;
 | 
					 | 
				
			||||||
use Illuminate\Broadcasting\PrivateChannel;
 | 
					use Illuminate\Broadcasting\PrivateChannel;
 | 
				
			||||||
use Illuminate\Contracts\Broadcasting\ShouldBroadcast;
 | 
					 | 
				
			||||||
use Illuminate\Foundation\Events\Dispatchable;
 | 
					use Illuminate\Foundation\Events\Dispatchable;
 | 
				
			||||||
use Illuminate\Queue\SerializesModels;
 | 
					use Illuminate\Queue\SerializesModels;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
				
			|||||||
@ -14,9 +14,7 @@ namespace App\Events\Contact;
 | 
				
			|||||||
use App\Models\ClientContact;
 | 
					use App\Models\ClientContact;
 | 
				
			||||||
use Illuminate\Broadcasting\Channel;
 | 
					use Illuminate\Broadcasting\Channel;
 | 
				
			||||||
use Illuminate\Broadcasting\InteractsWithSockets;
 | 
					use Illuminate\Broadcasting\InteractsWithSockets;
 | 
				
			||||||
use Illuminate\Broadcasting\PresenceChannel;
 | 
					 | 
				
			||||||
use Illuminate\Broadcasting\PrivateChannel;
 | 
					use Illuminate\Broadcasting\PrivateChannel;
 | 
				
			||||||
use Illuminate\Contracts\Broadcasting\ShouldBroadcast;
 | 
					 | 
				
			||||||
use Illuminate\Foundation\Events\Dispatchable;
 | 
					use Illuminate\Foundation\Events\Dispatchable;
 | 
				
			||||||
use Illuminate\Queue\SerializesModels;
 | 
					use Illuminate\Queue\SerializesModels;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
				
			|||||||
@ -15,9 +15,7 @@ use App\Models\Company;
 | 
				
			|||||||
use App\Models\Design;
 | 
					use App\Models\Design;
 | 
				
			||||||
use Illuminate\Broadcasting\Channel;
 | 
					use Illuminate\Broadcasting\Channel;
 | 
				
			||||||
use Illuminate\Broadcasting\InteractsWithSockets;
 | 
					use Illuminate\Broadcasting\InteractsWithSockets;
 | 
				
			||||||
use Illuminate\Broadcasting\PresenceChannel;
 | 
					 | 
				
			||||||
use Illuminate\Broadcasting\PrivateChannel;
 | 
					use Illuminate\Broadcasting\PrivateChannel;
 | 
				
			||||||
use Illuminate\Contracts\Broadcasting\ShouldBroadcast;
 | 
					 | 
				
			||||||
use Illuminate\Foundation\Events\Dispatchable;
 | 
					use Illuminate\Foundation\Events\Dispatchable;
 | 
				
			||||||
use Illuminate\Queue\SerializesModels;
 | 
					use Illuminate\Queue\SerializesModels;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
				
			|||||||
@ -13,7 +13,6 @@ namespace App\Events\Design;
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
use App\Models\Company;
 | 
					use App\Models\Company;
 | 
				
			||||||
use App\Models\Design;
 | 
					use App\Models\Design;
 | 
				
			||||||
use Illuminate\Broadcasting\Channel;
 | 
					 | 
				
			||||||
use Illuminate\Queue\SerializesModels;
 | 
					use Illuminate\Queue\SerializesModels;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
/**
 | 
					/**
 | 
				
			||||||
 | 
				
			|||||||
@ -13,7 +13,6 @@ namespace App\Events\Design;
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
use App\Models\Company;
 | 
					use App\Models\Company;
 | 
				
			||||||
use App\Models\Design;
 | 
					use App\Models\Design;
 | 
				
			||||||
use Illuminate\Broadcasting\Channel;
 | 
					 | 
				
			||||||
use Illuminate\Queue\SerializesModels;
 | 
					use Illuminate\Queue\SerializesModels;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
/**
 | 
					/**
 | 
				
			||||||
 | 
				
			|||||||
@ -13,7 +13,6 @@ namespace App\Events\Design;
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
use App\Models\Company;
 | 
					use App\Models\Company;
 | 
				
			||||||
use App\Models\Design;
 | 
					use App\Models\Design;
 | 
				
			||||||
use Illuminate\Broadcasting\Channel;
 | 
					 | 
				
			||||||
use Illuminate\Queue\SerializesModels;
 | 
					use Illuminate\Queue\SerializesModels;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
/**
 | 
					/**
 | 
				
			||||||
 | 
				
			|||||||
@ -13,7 +13,6 @@ namespace App\Events\Design;
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
use App\Models\Company;
 | 
					use App\Models\Company;
 | 
				
			||||||
use App\Models\Design;
 | 
					use App\Models\Design;
 | 
				
			||||||
use Illuminate\Broadcasting\Channel;
 | 
					 | 
				
			||||||
use Illuminate\Queue\SerializesModels;
 | 
					use Illuminate\Queue\SerializesModels;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
/**
 | 
					/**
 | 
				
			||||||
 | 
				
			|||||||
@ -15,9 +15,7 @@ use App\Models\Company;
 | 
				
			|||||||
use App\Models\Document;
 | 
					use App\Models\Document;
 | 
				
			||||||
use Illuminate\Broadcasting\Channel;
 | 
					use Illuminate\Broadcasting\Channel;
 | 
				
			||||||
use Illuminate\Broadcasting\InteractsWithSockets;
 | 
					use Illuminate\Broadcasting\InteractsWithSockets;
 | 
				
			||||||
use Illuminate\Broadcasting\PresenceChannel;
 | 
					 | 
				
			||||||
use Illuminate\Broadcasting\PrivateChannel;
 | 
					use Illuminate\Broadcasting\PrivateChannel;
 | 
				
			||||||
use Illuminate\Contracts\Broadcasting\ShouldBroadcast;
 | 
					 | 
				
			||||||
use Illuminate\Foundation\Events\Dispatchable;
 | 
					use Illuminate\Foundation\Events\Dispatchable;
 | 
				
			||||||
use Illuminate\Queue\SerializesModels;
 | 
					use Illuminate\Queue\SerializesModels;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
				
			|||||||
@ -15,9 +15,7 @@ use App\Models\ClientGatewayToken;
 | 
				
			|||||||
use App\Models\Company;
 | 
					use App\Models\Company;
 | 
				
			||||||
use Illuminate\Broadcasting\Channel;
 | 
					use Illuminate\Broadcasting\Channel;
 | 
				
			||||||
use Illuminate\Broadcasting\InteractsWithSockets;
 | 
					use Illuminate\Broadcasting\InteractsWithSockets;
 | 
				
			||||||
use Illuminate\Broadcasting\PresenceChannel;
 | 
					 | 
				
			||||||
use Illuminate\Broadcasting\PrivateChannel;
 | 
					use Illuminate\Broadcasting\PrivateChannel;
 | 
				
			||||||
use Illuminate\Contracts\Broadcasting\ShouldBroadcast;
 | 
					 | 
				
			||||||
use Illuminate\Foundation\Events\Dispatchable;
 | 
					use Illuminate\Foundation\Events\Dispatchable;
 | 
				
			||||||
use Illuminate\Queue\SerializesModels;
 | 
					use Illuminate\Queue\SerializesModels;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
				
			|||||||
@ -11,14 +11,9 @@
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
namespace App\Events\Payment;
 | 
					namespace App\Events\Payment;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
use App\Models\Client;
 | 
					 | 
				
			||||||
use App\Models\Company;
 | 
					use App\Models\Company;
 | 
				
			||||||
use App\Models\Payment;
 | 
					use App\Models\Payment;
 | 
				
			||||||
use Illuminate\Broadcasting\Channel;
 | 
					 | 
				
			||||||
use Illuminate\Broadcasting\InteractsWithSockets;
 | 
					use Illuminate\Broadcasting\InteractsWithSockets;
 | 
				
			||||||
use Illuminate\Broadcasting\PresenceChannel;
 | 
					 | 
				
			||||||
use Illuminate\Broadcasting\PrivateChannel;
 | 
					 | 
				
			||||||
use Illuminate\Contracts\Broadcasting\ShouldBroadcast;
 | 
					 | 
				
			||||||
use Illuminate\Foundation\Events\Dispatchable;
 | 
					use Illuminate\Foundation\Events\Dispatchable;
 | 
				
			||||||
use Illuminate\Queue\SerializesModels;
 | 
					use Illuminate\Queue\SerializesModels;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
				
			|||||||
@ -11,14 +11,9 @@
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
namespace App\Events\Payment;
 | 
					namespace App\Events\Payment;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
use App\Models\Client;
 | 
					 | 
				
			||||||
use App\Models\Company;
 | 
					use App\Models\Company;
 | 
				
			||||||
use App\Models\Payment;
 | 
					use App\Models\Payment;
 | 
				
			||||||
use Illuminate\Broadcasting\Channel;
 | 
					 | 
				
			||||||
use Illuminate\Broadcasting\InteractsWithSockets;
 | 
					use Illuminate\Broadcasting\InteractsWithSockets;
 | 
				
			||||||
use Illuminate\Broadcasting\PresenceChannel;
 | 
					 | 
				
			||||||
use Illuminate\Broadcasting\PrivateChannel;
 | 
					 | 
				
			||||||
use Illuminate\Contracts\Broadcasting\ShouldBroadcast;
 | 
					 | 
				
			||||||
use Illuminate\Foundation\Events\Dispatchable;
 | 
					use Illuminate\Foundation\Events\Dispatchable;
 | 
				
			||||||
use Illuminate\Queue\SerializesModels;
 | 
					use Illuminate\Queue\SerializesModels;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
				
			|||||||
@ -12,7 +12,6 @@
 | 
				
			|||||||
namespace App\Events\Product;
 | 
					namespace App\Events\Product;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
use App\Models\Company;
 | 
					use App\Models\Company;
 | 
				
			||||||
use App\Models\Invoice;
 | 
					 | 
				
			||||||
use Illuminate\Queue\SerializesModels;
 | 
					use Illuminate\Queue\SerializesModels;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
/**
 | 
					/**
 | 
				
			||||||
 | 
				
			|||||||
@ -14,11 +14,7 @@ namespace App\Events\Quote;
 | 
				
			|||||||
use App\Models\ClientContact;
 | 
					use App\Models\ClientContact;
 | 
				
			||||||
use App\Models\Company;
 | 
					use App\Models\Company;
 | 
				
			||||||
use App\Models\Quote;
 | 
					use App\Models\Quote;
 | 
				
			||||||
use Illuminate\Broadcasting\Channel;
 | 
					 | 
				
			||||||
use Illuminate\Broadcasting\InteractsWithSockets;
 | 
					use Illuminate\Broadcasting\InteractsWithSockets;
 | 
				
			||||||
use Illuminate\Broadcasting\PresenceChannel;
 | 
					 | 
				
			||||||
use Illuminate\Broadcasting\PrivateChannel;
 | 
					 | 
				
			||||||
use Illuminate\Contracts\Broadcasting\ShouldBroadcast;
 | 
					 | 
				
			||||||
use Illuminate\Foundation\Events\Dispatchable;
 | 
					use Illuminate\Foundation\Events\Dispatchable;
 | 
				
			||||||
use Illuminate\Queue\SerializesModels;
 | 
					use Illuminate\Queue\SerializesModels;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
				
			|||||||
@ -15,9 +15,7 @@ use App\Models\Company;
 | 
				
			|||||||
use App\Models\User;
 | 
					use App\Models\User;
 | 
				
			||||||
use Illuminate\Broadcasting\Channel;
 | 
					use Illuminate\Broadcasting\Channel;
 | 
				
			||||||
use Illuminate\Broadcasting\InteractsWithSockets;
 | 
					use Illuminate\Broadcasting\InteractsWithSockets;
 | 
				
			||||||
use Illuminate\Broadcasting\PresenceChannel;
 | 
					 | 
				
			||||||
use Illuminate\Broadcasting\PrivateChannel;
 | 
					use Illuminate\Broadcasting\PrivateChannel;
 | 
				
			||||||
use Illuminate\Contracts\Broadcasting\ShouldBroadcast;
 | 
					 | 
				
			||||||
use Illuminate\Foundation\Events\Dispatchable;
 | 
					use Illuminate\Foundation\Events\Dispatchable;
 | 
				
			||||||
use Illuminate\Queue\SerializesModels;
 | 
					use Illuminate\Queue\SerializesModels;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
				
			|||||||
@ -15,9 +15,7 @@ use App\Models\Company;
 | 
				
			|||||||
use App\Models\User;
 | 
					use App\Models\User;
 | 
				
			||||||
use Illuminate\Broadcasting\Channel;
 | 
					use Illuminate\Broadcasting\Channel;
 | 
				
			||||||
use Illuminate\Broadcasting\InteractsWithSockets;
 | 
					use Illuminate\Broadcasting\InteractsWithSockets;
 | 
				
			||||||
use Illuminate\Broadcasting\PresenceChannel;
 | 
					 | 
				
			||||||
use Illuminate\Broadcasting\PrivateChannel;
 | 
					use Illuminate\Broadcasting\PrivateChannel;
 | 
				
			||||||
use Illuminate\Contracts\Broadcasting\ShouldBroadcast;
 | 
					 | 
				
			||||||
use Illuminate\Foundation\Events\Dispatchable;
 | 
					use Illuminate\Foundation\Events\Dispatchable;
 | 
				
			||||||
use Illuminate\Queue\SerializesModels;
 | 
					use Illuminate\Queue\SerializesModels;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
				
			|||||||
@ -15,9 +15,7 @@ use App\Models\Company;
 | 
				
			|||||||
use App\Models\User;
 | 
					use App\Models\User;
 | 
				
			||||||
use Illuminate\Broadcasting\Channel;
 | 
					use Illuminate\Broadcasting\Channel;
 | 
				
			||||||
use Illuminate\Broadcasting\InteractsWithSockets;
 | 
					use Illuminate\Broadcasting\InteractsWithSockets;
 | 
				
			||||||
use Illuminate\Broadcasting\PresenceChannel;
 | 
					 | 
				
			||||||
use Illuminate\Broadcasting\PrivateChannel;
 | 
					use Illuminate\Broadcasting\PrivateChannel;
 | 
				
			||||||
use Illuminate\Contracts\Broadcasting\ShouldBroadcast;
 | 
					 | 
				
			||||||
use Illuminate\Foundation\Events\Dispatchable;
 | 
					use Illuminate\Foundation\Events\Dispatchable;
 | 
				
			||||||
use Illuminate\Queue\SerializesModels;
 | 
					use Illuminate\Queue\SerializesModels;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
				
			|||||||
@ -15,9 +15,7 @@ use App\Models\Company;
 | 
				
			|||||||
use App\Models\User;
 | 
					use App\Models\User;
 | 
				
			||||||
use Illuminate\Broadcasting\Channel;
 | 
					use Illuminate\Broadcasting\Channel;
 | 
				
			||||||
use Illuminate\Broadcasting\InteractsWithSockets;
 | 
					use Illuminate\Broadcasting\InteractsWithSockets;
 | 
				
			||||||
use Illuminate\Broadcasting\PresenceChannel;
 | 
					 | 
				
			||||||
use Illuminate\Broadcasting\PrivateChannel;
 | 
					use Illuminate\Broadcasting\PrivateChannel;
 | 
				
			||||||
use Illuminate\Contracts\Broadcasting\ShouldBroadcast;
 | 
					 | 
				
			||||||
use Illuminate\Foundation\Events\Dispatchable;
 | 
					use Illuminate\Foundation\Events\Dispatchable;
 | 
				
			||||||
use Illuminate\Queue\SerializesModels;
 | 
					use Illuminate\Queue\SerializesModels;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
				
			|||||||
@ -15,9 +15,7 @@ use App\Models\Company;
 | 
				
			|||||||
use App\Models\User;
 | 
					use App\Models\User;
 | 
				
			||||||
use Illuminate\Broadcasting\Channel;
 | 
					use Illuminate\Broadcasting\Channel;
 | 
				
			||||||
use Illuminate\Broadcasting\InteractsWithSockets;
 | 
					use Illuminate\Broadcasting\InteractsWithSockets;
 | 
				
			||||||
use Illuminate\Broadcasting\PresenceChannel;
 | 
					 | 
				
			||||||
use Illuminate\Broadcasting\PrivateChannel;
 | 
					use Illuminate\Broadcasting\PrivateChannel;
 | 
				
			||||||
use Illuminate\Contracts\Broadcasting\ShouldBroadcast;
 | 
					 | 
				
			||||||
use Illuminate\Foundation\Events\Dispatchable;
 | 
					use Illuminate\Foundation\Events\Dispatchable;
 | 
				
			||||||
use Illuminate\Queue\SerializesModels;
 | 
					use Illuminate\Queue\SerializesModels;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
				
			|||||||
@ -15,9 +15,7 @@ use App\Models\Company;
 | 
				
			|||||||
use App\Models\User;
 | 
					use App\Models\User;
 | 
				
			||||||
use Illuminate\Broadcasting\Channel;
 | 
					use Illuminate\Broadcasting\Channel;
 | 
				
			||||||
use Illuminate\Broadcasting\InteractsWithSockets;
 | 
					use Illuminate\Broadcasting\InteractsWithSockets;
 | 
				
			||||||
use Illuminate\Broadcasting\PresenceChannel;
 | 
					 | 
				
			||||||
use Illuminate\Broadcasting\PrivateChannel;
 | 
					use Illuminate\Broadcasting\PrivateChannel;
 | 
				
			||||||
use Illuminate\Contracts\Broadcasting\ShouldBroadcast;
 | 
					 | 
				
			||||||
use Illuminate\Foundation\Events\Dispatchable;
 | 
					use Illuminate\Foundation\Events\Dispatchable;
 | 
				
			||||||
use Illuminate\Queue\SerializesModels;
 | 
					use Illuminate\Queue\SerializesModels;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
				
			|||||||
@ -3,7 +3,6 @@
 | 
				
			|||||||
namespace App\Exceptions;
 | 
					namespace App\Exceptions;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
use Exception;
 | 
					use Exception;
 | 
				
			||||||
use Throwable;
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
class GenericPaymentDriverFailure extends Exception
 | 
					class GenericPaymentDriverFailure extends Exception
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
 | 
				
			|||||||
@ -11,7 +11,6 @@
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
namespace App\Exceptions;
 | 
					namespace App\Exceptions;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
use App\Exceptions\GenericPaymentDriverFailure;
 | 
					 | 
				
			||||||
use App\Models\Account;
 | 
					use App\Models\Account;
 | 
				
			||||||
use Exception;
 | 
					use Exception;
 | 
				
			||||||
use Illuminate\Auth\Access\AuthorizationException;
 | 
					use Illuminate\Auth\Access\AuthorizationException;
 | 
				
			||||||
@ -35,7 +34,6 @@ use Symfony\Component\Debug\Exception\FatalThrowableError;
 | 
				
			|||||||
use Symfony\Component\HttpKernel\Exception\MethodNotAllowedHttpException;
 | 
					use Symfony\Component\HttpKernel\Exception\MethodNotAllowedHttpException;
 | 
				
			||||||
use Symfony\Component\HttpKernel\Exception\NotFoundHttpException;
 | 
					use Symfony\Component\HttpKernel\Exception\NotFoundHttpException;
 | 
				
			||||||
use Throwable;
 | 
					use Throwable;
 | 
				
			||||||
use function Sentry\configureScope;
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
class Handler extends ExceptionHandler
 | 
					class Handler extends ExceptionHandler
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
 | 
				
			|||||||
@ -3,7 +3,6 @@
 | 
				
			|||||||
namespace App\Exceptions;
 | 
					namespace App\Exceptions;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
use Exception;
 | 
					use Exception;
 | 
				
			||||||
use Throwable;
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
class MigrationValidatorFailed extends Exception
 | 
					class MigrationValidatorFailed extends Exception
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
 | 
				
			|||||||
@ -3,7 +3,6 @@
 | 
				
			|||||||
namespace App\Exceptions;
 | 
					namespace App\Exceptions;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
use Exception;
 | 
					use Exception;
 | 
				
			||||||
use Throwable;
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
class NonExistingMigrationFile extends Exception
 | 
					class NonExistingMigrationFile extends Exception
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
 | 
				
			|||||||
@ -3,7 +3,6 @@
 | 
				
			|||||||
namespace App\Exceptions;
 | 
					namespace App\Exceptions;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
use Exception;
 | 
					use Exception;
 | 
				
			||||||
use Throwable;
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
class ProcessingMigrationArchiveFailed extends Exception
 | 
					class ProcessingMigrationArchiveFailed extends Exception
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
 | 
				
			|||||||
@ -3,7 +3,6 @@
 | 
				
			|||||||
namespace App\Exceptions;
 | 
					namespace App\Exceptions;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
use Exception;
 | 
					use Exception;
 | 
				
			||||||
use Throwable;
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
class ResourceDependencyMissing extends Exception
 | 
					class ResourceDependencyMissing extends Exception
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
 | 
				
			|||||||
@ -3,7 +3,6 @@
 | 
				
			|||||||
namespace App\Exceptions;
 | 
					namespace App\Exceptions;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
use Exception;
 | 
					use Exception;
 | 
				
			||||||
use Throwable;
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
class ResourceNotAvailableForMigration extends Exception
 | 
					class ResourceNotAvailableForMigration extends Exception
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
 | 
				
			|||||||
@ -11,10 +11,7 @@
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
namespace App\Factory;
 | 
					namespace App\Factory;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
use App\DataMapper\ClientSettings;
 | 
					 | 
				
			||||||
use App\DataMapper\CompanySettings;
 | 
					 | 
				
			||||||
use App\Models\ExpenseCategory;
 | 
					use App\Models\ExpenseCategory;
 | 
				
			||||||
use Illuminate\Support\Facades\Log;
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
class ExpenseCategoryFactory
 | 
					class ExpenseCategoryFactory
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
 | 
				
			|||||||
@ -11,10 +11,7 @@
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
namespace App\Factory;
 | 
					namespace App\Factory;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
use App\DataMapper\ClientSettings;
 | 
					 | 
				
			||||||
use App\DataMapper\CompanySettings;
 | 
					 | 
				
			||||||
use App\Models\Expense;
 | 
					use App\Models\Expense;
 | 
				
			||||||
use Illuminate\Support\Facades\Log;
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
class ExpenseFactory
 | 
					class ExpenseFactory
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
 | 
				
			|||||||
@ -11,11 +11,7 @@
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
namespace App\Factory;
 | 
					namespace App\Factory;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
use App\DataMapper\ClientSettings;
 | 
					 | 
				
			||||||
use App\DataMapper\CompanySettings;
 | 
					 | 
				
			||||||
use App\Models\Client;
 | 
					 | 
				
			||||||
use App\Models\Invoice;
 | 
					use App\Models\Invoice;
 | 
				
			||||||
use Illuminate\Support\Facades\Log;
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
class InvoiceFactory
 | 
					class InvoiceFactory
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
 | 
				
			|||||||
@ -12,7 +12,6 @@
 | 
				
			|||||||
namespace App\Factory;
 | 
					namespace App\Factory;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
use Faker\Factory;
 | 
					use Faker\Factory;
 | 
				
			||||||
use Illuminate\Support\Carbon;
 | 
					 | 
				
			||||||
use stdClass;
 | 
					use stdClass;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
//use Faker\Generator as Faker;
 | 
					//use Faker\Generator as Faker;
 | 
				
			||||||
 | 
				
			|||||||
@ -11,8 +11,6 @@
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
namespace App\Factory;
 | 
					namespace App\Factory;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
use App\DataMapper\ClientSettings;
 | 
					 | 
				
			||||||
use App\DataMapper\CompanySettings;
 | 
					 | 
				
			||||||
use App\Models\Invoice;
 | 
					use App\Models\Invoice;
 | 
				
			||||||
use App\Models\RecurringInvoice;
 | 
					use App\Models\RecurringInvoice;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
				
			|||||||
@ -11,11 +11,8 @@
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
namespace App\Factory;
 | 
					namespace App\Factory;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
use App\DataMapper\ClientSettings;
 | 
					 | 
				
			||||||
use App\DataMapper\CompanySettings;
 | 
					 | 
				
			||||||
use App\Models\Payment;
 | 
					use App\Models\Payment;
 | 
				
			||||||
use Illuminate\Support\Carbon;
 | 
					use Illuminate\Support\Carbon;
 | 
				
			||||||
use Illuminate\Support\Facades\Log;
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
class PaymentFactory
 | 
					class PaymentFactory
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
 | 
				
			|||||||
@ -11,11 +11,7 @@
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
namespace App\Factory;
 | 
					namespace App\Factory;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
use App\DataMapper\ClientSettings;
 | 
					 | 
				
			||||||
use App\DataMapper\CompanySettings;
 | 
					 | 
				
			||||||
use App\Models\Client;
 | 
					 | 
				
			||||||
use App\Models\Quote;
 | 
					use App\Models\Quote;
 | 
				
			||||||
use Illuminate\Support\Facades\Log;
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
class QuoteFactory
 | 
					class QuoteFactory
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
 | 
				
			|||||||
@ -11,8 +11,6 @@
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
namespace App\Factory;
 | 
					namespace App\Factory;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
use App\DataMapper\ClientSettings;
 | 
					 | 
				
			||||||
use App\DataMapper\CompanySettings;
 | 
					 | 
				
			||||||
use App\Models\RecurringInvoice;
 | 
					use App\Models\RecurringInvoice;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
class RecurringInvoiceFactory
 | 
					class RecurringInvoiceFactory
 | 
				
			||||||
 | 
				
			|||||||
@ -11,8 +11,6 @@
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
namespace App\Factory;
 | 
					namespace App\Factory;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
use App\DataMapper\ClientSettings;
 | 
					 | 
				
			||||||
use App\DataMapper\CompanySettings;
 | 
					 | 
				
			||||||
use App\Models\Client;
 | 
					use App\Models\Client;
 | 
				
			||||||
use App\Models\Invoice;
 | 
					use App\Models\Invoice;
 | 
				
			||||||
use App\Models\RecurringInvoice;
 | 
					use App\Models\RecurringInvoice;
 | 
				
			||||||
 | 
				
			|||||||
@ -11,8 +11,6 @@
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
namespace App\Factory;
 | 
					namespace App\Factory;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
use App\DataMapper\ClientSettings;
 | 
					 | 
				
			||||||
use App\DataMapper\CompanySettings;
 | 
					 | 
				
			||||||
use App\Models\RecurringQuote;
 | 
					use App\Models\RecurringQuote;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
class RecurringQuoteFactory
 | 
					class RecurringQuoteFactory
 | 
				
			||||||
 | 
				
			|||||||
@ -24,9 +24,9 @@ class TaskFactory
 | 
				
			|||||||
        $task->company_id = $company_id;
 | 
					        $task->company_id = $company_id;
 | 
				
			||||||
        $task->user_id = $user_id;
 | 
					        $task->user_id = $user_id;
 | 
				
			||||||
        $task->time_log = '[]';
 | 
					        $task->time_log = '[]';
 | 
				
			||||||
		$task->is_running = false;
 | 
					        $task->is_running = false;
 | 
				
			||||||
		$task->is_deleted = false;
 | 
					        $task->is_deleted = false;
 | 
				
			||||||
		$task->duration = 0;
 | 
					        $task->duration = 0;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        return $task;
 | 
					        return $task;
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
				
			|||||||
@ -13,11 +13,9 @@
 | 
				
			|||||||
namespace App\Filters;
 | 
					namespace App\Filters;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
use App\Models\Credit;
 | 
					use App\Models\Credit;
 | 
				
			||||||
use App\Models\Invoice;
 | 
					 | 
				
			||||||
use App\Models\User;
 | 
					use App\Models\User;
 | 
				
			||||||
use Illuminate\Database\Eloquent\Builder;
 | 
					use Illuminate\Database\Eloquent\Builder;
 | 
				
			||||||
use Illuminate\Support\Carbon;
 | 
					use Illuminate\Support\Carbon;
 | 
				
			||||||
use Illuminate\Support\Facades\Log;
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
class CreditFilters extends QueryFilters
 | 
					class CreditFilters extends QueryFilters
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
 | 
				
			|||||||
@ -15,7 +15,6 @@ use App\Models\Invoice;
 | 
				
			|||||||
use App\Models\User;
 | 
					use App\Models\User;
 | 
				
			||||||
use Illuminate\Database\Eloquent\Builder;
 | 
					use Illuminate\Database\Eloquent\Builder;
 | 
				
			||||||
use Illuminate\Support\Carbon;
 | 
					use Illuminate\Support\Carbon;
 | 
				
			||||||
use Illuminate\Support\Facades\Log;
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
/**
 | 
					/**
 | 
				
			||||||
 * InvoiceFilters.
 | 
					 * InvoiceFilters.
 | 
				
			||||||
 | 
				
			|||||||
@ -13,7 +13,6 @@ namespace App\Filters;
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
use App\Models\User;
 | 
					use App\Models\User;
 | 
				
			||||||
use Illuminate\Database\Eloquent\Builder;
 | 
					use Illuminate\Database\Eloquent\Builder;
 | 
				
			||||||
use Illuminate\Support\Facades\Log;
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
/**
 | 
					/**
 | 
				
			||||||
 * PaymentFilters.
 | 
					 * PaymentFilters.
 | 
				
			||||||
 | 
				
			|||||||
@ -11,7 +11,6 @@
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
namespace App\Filters;
 | 
					namespace App\Filters;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
use App\Models\User;
 | 
					 | 
				
			||||||
//use Illuminate\Database\Query\Builder;
 | 
					//use Illuminate\Database\Query\Builder;
 | 
				
			||||||
use Illuminate\Database\Eloquent\Builder;
 | 
					use Illuminate\Database\Eloquent\Builder;
 | 
				
			||||||
use Illuminate\Http\Request;
 | 
					use Illuminate\Http\Request;
 | 
				
			||||||
 | 
				
			|||||||
@ -12,10 +12,7 @@
 | 
				
			|||||||
namespace App\Filters;
 | 
					namespace App\Filters;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
use App\Models\User;
 | 
					use App\Models\User;
 | 
				
			||||||
use App\Models\Vendor;
 | 
					 | 
				
			||||||
use Illuminate\Database\Eloquent\Builder;
 | 
					use Illuminate\Database\Eloquent\Builder;
 | 
				
			||||||
use Illuminate\Support\Facades\DB;
 | 
					 | 
				
			||||||
use Illuminate\Support\Facades\Gate;
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
/**
 | 
					/**
 | 
				
			||||||
 * SystemLogFilters.
 | 
					 * SystemLogFilters.
 | 
				
			||||||
@ -51,13 +48,11 @@ class SystemLogFilters extends QueryFilters
 | 
				
			|||||||
     */
 | 
					     */
 | 
				
			||||||
    public function filter(string $filter = '') : Builder
 | 
					    public function filter(string $filter = '') : Builder
 | 
				
			||||||
    {
 | 
					    {
 | 
				
			||||||
 | 
					 | 
				
			||||||
        if (strlen($filter) == 0) {
 | 
					        if (strlen($filter) == 0) {
 | 
				
			||||||
            return $this->builder;
 | 
					            return $this->builder;
 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        return $this->builder;
 | 
					        return $this->builder;
 | 
				
			||||||
 | 
					 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    /**
 | 
					    /**
 | 
				
			||||||
 | 
				
			|||||||
@ -12,7 +12,6 @@
 | 
				
			|||||||
namespace App\Filters;
 | 
					namespace App\Filters;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
use App\Models\User;
 | 
					use App\Models\User;
 | 
				
			||||||
use App\Models\Vendor;
 | 
					 | 
				
			||||||
use Illuminate\Database\Eloquent\Builder;
 | 
					use Illuminate\Database\Eloquent\Builder;
 | 
				
			||||||
use Illuminate\Support\Facades\DB;
 | 
					use Illuminate\Support\Facades\DB;
 | 
				
			||||||
use Illuminate\Support\Facades\Gate;
 | 
					use Illuminate\Support\Facades\Gate;
 | 
				
			||||||
 | 
				
			|||||||
@ -13,11 +13,8 @@ namespace App\Helpers\Invoice;
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
use App\DataMapper\BaseSettings;
 | 
					use App\DataMapper\BaseSettings;
 | 
				
			||||||
use App\DataMapper\InvoiceItem;
 | 
					use App\DataMapper\InvoiceItem;
 | 
				
			||||||
use App\Helpers\Invoice\Discounter;
 | 
					 | 
				
			||||||
use App\Helpers\Invoice\Taxer;
 | 
					 | 
				
			||||||
use App\Models\Invoice;
 | 
					use App\Models\Invoice;
 | 
				
			||||||
use App\Utils\Traits\NumberFormatter;
 | 
					use App\Utils\Traits\NumberFormatter;
 | 
				
			||||||
use Illuminate\Support\Collection;
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
class InvoiceItemSum
 | 
					class InvoiceItemSum
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
@ -231,7 +228,7 @@ class InvoiceItemSum
 | 
				
			|||||||
            }
 | 
					            }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
            //$amount = $this->item->line_total - ($this->item->line_total * ($this->invoice->discount / $this->sub_total));
 | 
					            //$amount = $this->item->line_total - ($this->item->line_total * ($this->invoice->discount / $this->sub_total));
 | 
				
			||||||
            $amount = ( $this->sub_total > 0 ) ? $this->item->line_total - ($this->item->line_total * ($this->invoice->discount / $this->sub_total)) : 0;
 | 
					            $amount = ($this->sub_total > 0) ? $this->item->line_total - ($this->item->line_total * ($this->invoice->discount / $this->sub_total)) : 0;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
            $item_tax_rate1_total = $this->calcAmountLineTax($this->item->tax_rate1, $amount);
 | 
					            $item_tax_rate1_total = $this->calcAmountLineTax($this->item->tax_rate1, $amount);
 | 
				
			||||||
@ -264,7 +261,7 @@ class InvoiceItemSum
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
    /**
 | 
					    /**
 | 
				
			||||||
     * Sets default casts for the values in the line_items.
 | 
					     * Sets default casts for the values in the line_items.
 | 
				
			||||||
     * 
 | 
					     *
 | 
				
			||||||
     * @return $this
 | 
					     * @return $this
 | 
				
			||||||
     */
 | 
					     */
 | 
				
			||||||
    private function cleanLineItem()
 | 
					    private function cleanLineItem()
 | 
				
			||||||
 | 
				
			|||||||
@ -11,11 +11,8 @@
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
namespace App\Helpers\Invoice;
 | 
					namespace App\Helpers\Invoice;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
use App\Helpers\Invoice\Discounter;
 | 
					 | 
				
			||||||
use App\Helpers\Invoice\Taxer;
 | 
					 | 
				
			||||||
use App\Models\Invoice;
 | 
					use App\Models\Invoice;
 | 
				
			||||||
use App\Utils\Traits\NumberFormatter;
 | 
					use App\Utils\Traits\NumberFormatter;
 | 
				
			||||||
use Illuminate\Support\Collection;
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
class InvoiceItemSumInclusive
 | 
					class InvoiceItemSumInclusive
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
 | 
				
			|||||||
@ -11,11 +11,6 @@
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
namespace App\Helpers\Invoice;
 | 
					namespace App\Helpers\Invoice;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
use App\Helpers\Invoice\Balancer;
 | 
					 | 
				
			||||||
use App\Helpers\Invoice\CustomValuer;
 | 
					 | 
				
			||||||
use App\Helpers\Invoice\Discounter;
 | 
					 | 
				
			||||||
use App\Helpers\Invoice\InvoiceItemSum;
 | 
					 | 
				
			||||||
use App\Helpers\Invoice\Taxer;
 | 
					 | 
				
			||||||
use App\Models\Invoice;
 | 
					use App\Models\Invoice;
 | 
				
			||||||
use App\Utils\Traits\NumberFormatter;
 | 
					use App\Utils\Traits\NumberFormatter;
 | 
				
			||||||
use Illuminate\Support\Collection;
 | 
					use Illuminate\Support\Collection;
 | 
				
			||||||
@ -160,17 +155,21 @@ class InvoiceSum
 | 
				
			|||||||
    {
 | 
					    {
 | 
				
			||||||
        $this->total += $this->total_taxes;
 | 
					        $this->total += $this->total_taxes;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        if(is_numeric($this->invoice->custom_value1) && $this->invoice->custom_value1 > 0)
 | 
					        if (is_numeric($this->invoice->custom_value1) && $this->invoice->custom_value1 > 0) {
 | 
				
			||||||
            $this->total += $this->invoice->custom_value1;
 | 
					            $this->total += $this->invoice->custom_value1;
 | 
				
			||||||
 | 
					        }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        if(is_numeric($this->invoice->custom_value2) && $this->invoice->custom_value2 > 0)
 | 
					        if (is_numeric($this->invoice->custom_value2) && $this->invoice->custom_value2 > 0) {
 | 
				
			||||||
            $this->total += $this->invoice->custom_value2;
 | 
					            $this->total += $this->invoice->custom_value2;
 | 
				
			||||||
 | 
					        }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        if(is_numeric($this->invoice->custom_value3) && $this->invoice->custom_value3 > 0)
 | 
					        if (is_numeric($this->invoice->custom_value3) && $this->invoice->custom_value3 > 0) {
 | 
				
			||||||
            $this->total += $this->invoice->custom_value3;
 | 
					            $this->total += $this->invoice->custom_value3;
 | 
				
			||||||
 | 
					        }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        if(is_numeric($this->invoice->custom_value4) && $this->invoice->custom_value4 > 0)
 | 
					        if (is_numeric($this->invoice->custom_value4) && $this->invoice->custom_value4 > 0) {
 | 
				
			||||||
            $this->total += $this->invoice->custom_value4;
 | 
					            $this->total += $this->invoice->custom_value4;
 | 
				
			||||||
 | 
					        }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        return $this;
 | 
					        return $this;
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
@ -202,7 +201,6 @@ class InvoiceSum
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
    public function getRecurringInvoice()
 | 
					    public function getRecurringInvoice()
 | 
				
			||||||
    {
 | 
					    {
 | 
				
			||||||
 | 
					 | 
				
			||||||
        $this->invoice->amount = $this->formatValue($this->getTotal(), $this->invoice->client->currency()->precision);
 | 
					        $this->invoice->amount = $this->formatValue($this->getTotal(), $this->invoice->client->currency()->precision);
 | 
				
			||||||
        $this->invoice->total_taxes = $this->getTotalTaxes();
 | 
					        $this->invoice->total_taxes = $this->getTotalTaxes();
 | 
				
			||||||
        $this->invoice->balance = $this->formatValue($this->getTotal(), $this->invoice->client->currency()->precision);
 | 
					        $this->invoice->balance = $this->formatValue($this->getTotal(), $this->invoice->client->currency()->precision);
 | 
				
			||||||
@ -220,8 +218,7 @@ class InvoiceSum
 | 
				
			|||||||
    {
 | 
					    {
 | 
				
			||||||
        /* If amount != balance then some money has been paid on the invoice, need to subtract this difference from the total to set the new balance */
 | 
					        /* If amount != balance then some money has been paid on the invoice, need to subtract this difference from the total to set the new balance */
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        if($this->invoice->status_id != Invoice::STATUS_DRAFT)
 | 
					        if ($this->invoice->status_id != Invoice::STATUS_DRAFT) {
 | 
				
			||||||
        {
 | 
					 | 
				
			||||||
            if ($this->invoice->amount != $this->invoice->balance) {
 | 
					            if ($this->invoice->amount != $this->invoice->balance) {
 | 
				
			||||||
                $paid_to_date = $this->invoice->amount - $this->invoice->balance;
 | 
					                $paid_to_date = $this->invoice->amount - $this->invoice->balance;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@ -318,7 +315,6 @@ class InvoiceSum
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
    public function purgeTaxes()
 | 
					    public function purgeTaxes()
 | 
				
			||||||
    {
 | 
					    {
 | 
				
			||||||
 | 
					 | 
				
			||||||
        $this->tax_rate1 = 0;
 | 
					        $this->tax_rate1 = 0;
 | 
				
			||||||
        $this->tax_name1 = '';
 | 
					        $this->tax_name1 = '';
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@ -332,7 +328,7 @@ class InvoiceSum
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
        $line_items = collect($this->invoice->line_items);
 | 
					        $line_items = collect($this->invoice->line_items);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        $items = $line_items->map(function ($item){
 | 
					        $items = $line_items->map(function ($item) {
 | 
				
			||||||
            $item->tax_rate1 = 0;
 | 
					            $item->tax_rate1 = 0;
 | 
				
			||||||
            $item->tax_rate2 = 0;
 | 
					            $item->tax_rate2 = 0;
 | 
				
			||||||
            $item->tax_rate3 = 0;
 | 
					            $item->tax_rate3 = 0;
 | 
				
			||||||
@ -350,5 +346,4 @@ class InvoiceSum
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
        return $this;
 | 
					        return $this;
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
					 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
				
			|||||||
@ -11,12 +11,6 @@
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
namespace App\Helpers\Invoice;
 | 
					namespace App\Helpers\Invoice;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
use App\Helpers\Invoice\Balancer;
 | 
					 | 
				
			||||||
use App\Helpers\Invoice\CustomValuer;
 | 
					 | 
				
			||||||
use App\Helpers\Invoice\Discounter;
 | 
					 | 
				
			||||||
use App\Helpers\Invoice\InvoiceItemSum;
 | 
					 | 
				
			||||||
use App\Helpers\Invoice\InvoiceItemSumInclusive;
 | 
					 | 
				
			||||||
use App\Helpers\Invoice\Taxer;
 | 
					 | 
				
			||||||
use App\Models\Invoice;
 | 
					use App\Models\Invoice;
 | 
				
			||||||
use App\Utils\Traits\NumberFormatter;
 | 
					use App\Utils\Traits\NumberFormatter;
 | 
				
			||||||
use Illuminate\Support\Collection;
 | 
					use Illuminate\Support\Collection;
 | 
				
			||||||
@ -66,7 +60,7 @@ class InvoiceSumInclusive
 | 
				
			|||||||
             ->calculateCustomValues()
 | 
					             ->calculateCustomValues()
 | 
				
			||||||
             ->calculateInvoiceTaxes()
 | 
					             ->calculateInvoiceTaxes()
 | 
				
			||||||
             ->setTaxMap()
 | 
					             ->setTaxMap()
 | 
				
			||||||
			 ->calculateTotals() //just don't add the taxes!!
 | 
					             ->calculateTotals() //just don't add the taxes!!
 | 
				
			||||||
             ->calculateBalance()
 | 
					             ->calculateBalance()
 | 
				
			||||||
             ->calculatePartial();
 | 
					             ->calculatePartial();
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@ -172,24 +166,27 @@ class InvoiceSumInclusive
 | 
				
			|||||||
    {
 | 
					    {
 | 
				
			||||||
        //$this->total += $this->total_taxes;
 | 
					        //$this->total += $this->total_taxes;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        if(is_numeric($this->invoice->custom_value1) && $this->invoice->custom_value1 > 0)
 | 
					        if (is_numeric($this->invoice->custom_value1) && $this->invoice->custom_value1 > 0) {
 | 
				
			||||||
            $this->total += $this->invoice->custom_value1;
 | 
					            $this->total += $this->invoice->custom_value1;
 | 
				
			||||||
 | 
					        }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        if(is_numeric($this->invoice->custom_value2) && $this->invoice->custom_value2 > 0)
 | 
					        if (is_numeric($this->invoice->custom_value2) && $this->invoice->custom_value2 > 0) {
 | 
				
			||||||
            $this->total += $this->invoice->custom_value2;
 | 
					            $this->total += $this->invoice->custom_value2;
 | 
				
			||||||
 | 
					        }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        if(is_numeric($this->invoice->custom_value3) && $this->invoice->custom_value3 > 0)
 | 
					        if (is_numeric($this->invoice->custom_value3) && $this->invoice->custom_value3 > 0) {
 | 
				
			||||||
            $this->total += $this->invoice->custom_value3;
 | 
					            $this->total += $this->invoice->custom_value3;
 | 
				
			||||||
 | 
					        }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        if(is_numeric($this->invoice->custom_value4) && $this->invoice->custom_value4 > 0)
 | 
					        if (is_numeric($this->invoice->custom_value4) && $this->invoice->custom_value4 > 0) {
 | 
				
			||||||
            $this->total += $this->invoice->custom_value4;     
 | 
					            $this->total += $this->invoice->custom_value4;
 | 
				
			||||||
 | 
					        }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        return $this;
 | 
					        return $this;
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    public function getRecurringInvoice()
 | 
					    public function getRecurringInvoice()
 | 
				
			||||||
    {
 | 
					    {
 | 
				
			||||||
 | 
					 | 
				
			||||||
        $this->invoice->amount = $this->formatValue($this->getTotal(), $this->invoice->client->currency()->precision);
 | 
					        $this->invoice->amount = $this->formatValue($this->getTotal(), $this->invoice->client->currency()->precision);
 | 
				
			||||||
        $this->invoice->total_taxes = $this->getTotalTaxes();
 | 
					        $this->invoice->total_taxes = $this->getTotalTaxes();
 | 
				
			||||||
        $this->invoice->balance = $this->formatValue($this->getTotal(), $this->invoice->client->currency()->precision);
 | 
					        $this->invoice->balance = $this->formatValue($this->getTotal(), $this->invoice->client->currency()->precision);
 | 
				
			||||||
@ -329,7 +326,6 @@ class InvoiceSumInclusive
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
    public function purgeTaxes()
 | 
					    public function purgeTaxes()
 | 
				
			||||||
    {
 | 
					    {
 | 
				
			||||||
 | 
					 | 
				
			||||||
        return $this;
 | 
					        return $this;
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
				
			|||||||
@ -11,11 +11,8 @@
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
namespace App\Helpers\Mail;
 | 
					namespace App\Helpers\Mail;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
use App\Libraries\MultiDB;
 | 
					 | 
				
			||||||
use App\Models\User;
 | 
					 | 
				
			||||||
use Dacastro4\LaravelGmail\Services\Message\Mail;
 | 
					use Dacastro4\LaravelGmail\Services\Message\Mail;
 | 
				
			||||||
use Illuminate\Mail\Transport\Transport;
 | 
					use Illuminate\Mail\Transport\Transport;
 | 
				
			||||||
use Log;
 | 
					 | 
				
			||||||
use Swift_Mime_SimpleMessage;
 | 
					use Swift_Mime_SimpleMessage;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
/**
 | 
					/**
 | 
				
			||||||
 | 
				
			|||||||
@ -2,7 +2,6 @@
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
namespace App\Helpers\Mail;
 | 
					namespace App\Helpers\Mail;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
use App\Helpers\Mail\GmailTransport;
 | 
					 | 
				
			||||||
use Dacastro4\LaravelGmail\Services\Message\Mail;
 | 
					use Dacastro4\LaravelGmail\Services\Message\Mail;
 | 
				
			||||||
use Illuminate\Mail\TransportManager;
 | 
					use Illuminate\Mail\TransportManager;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
				
			|||||||
@ -12,16 +12,12 @@
 | 
				
			|||||||
namespace App\Http\Controllers;
 | 
					namespace App\Http\Controllers;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
use App\Http\Requests\Account\CreateAccountRequest;
 | 
					use App\Http\Requests\Account\CreateAccountRequest;
 | 
				
			||||||
use App\Http\Requests\SignupRequest;
 | 
					 | 
				
			||||||
use App\Jobs\Account\CreateAccount;
 | 
					use App\Jobs\Account\CreateAccount;
 | 
				
			||||||
use App\Models\Account;
 | 
					use App\Models\Account;
 | 
				
			||||||
use App\Models\CompanyUser;
 | 
					use App\Models\CompanyUser;
 | 
				
			||||||
use App\Transformers\AccountTransformer;
 | 
					 | 
				
			||||||
use App\Transformers\CompanyUserTransformer;
 | 
					use App\Transformers\CompanyUserTransformer;
 | 
				
			||||||
use Illuminate\Foundation\Bus\DispatchesJobs;
 | 
					use Illuminate\Foundation\Bus\DispatchesJobs;
 | 
				
			||||||
use Illuminate\Http\Request;
 | 
					 | 
				
			||||||
use Illuminate\Http\Response;
 | 
					use Illuminate\Http\Response;
 | 
				
			||||||
use Illuminate\Support\Facades\Log;
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
class AccountController extends BaseController
 | 
					class AccountController extends BaseController
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
 | 
				
			|||||||
@ -80,5 +80,4 @@ class ContactLoginController extends Controller
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
        return redirect('/client/login');
 | 
					        return redirect('/client/login');
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
					 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
				
			|||||||
@ -7,7 +7,6 @@ use App\Factory\ClientFactory;
 | 
				
			|||||||
use App\Http\Controllers\Controller;
 | 
					use App\Http\Controllers\Controller;
 | 
				
			||||||
use App\Http\Requests\ClientPortal\RegisterRequest;
 | 
					use App\Http\Requests\ClientPortal\RegisterRequest;
 | 
				
			||||||
use App\Models\Client;
 | 
					use App\Models\Client;
 | 
				
			||||||
use App\Models\ClientContact;
 | 
					 | 
				
			||||||
use App\Models\Company;
 | 
					use App\Models\Company;
 | 
				
			||||||
use Illuminate\Support\Facades\Auth;
 | 
					use Illuminate\Support\Facades\Auth;
 | 
				
			||||||
use Illuminate\Support\Facades\Hash;
 | 
					use Illuminate\Support\Facades\Hash;
 | 
				
			||||||
 | 
				
			|||||||
@ -23,14 +23,11 @@ use App\Models\CompanyToken;
 | 
				
			|||||||
use App\Models\CompanyUser;
 | 
					use App\Models\CompanyUser;
 | 
				
			||||||
use App\Models\User;
 | 
					use App\Models\User;
 | 
				
			||||||
use App\Transformers\CompanyUserTransformer;
 | 
					use App\Transformers\CompanyUserTransformer;
 | 
				
			||||||
use App\Transformers\UserTransformer;
 | 
					 | 
				
			||||||
use App\Utils\Traits\UserSessionAttributes;
 | 
					use App\Utils\Traits\UserSessionAttributes;
 | 
				
			||||||
use Google_Client;
 | 
					use Google_Client;
 | 
				
			||||||
use Illuminate\Foundation\Auth\AuthenticatesUsers;
 | 
					use Illuminate\Foundation\Auth\AuthenticatesUsers;
 | 
				
			||||||
use Illuminate\Http\Request;
 | 
					use Illuminate\Http\Request;
 | 
				
			||||||
use Illuminate\Support\Facades\Auth;
 | 
					use Illuminate\Support\Facades\Auth;
 | 
				
			||||||
use Illuminate\Support\Facades\Log;
 | 
					 | 
				
			||||||
use Laravel\Socialite\Facades\Socialite;
 | 
					 | 
				
			||||||
use Turbo124\Beacon\Facades\LightLogs;
 | 
					use Turbo124\Beacon\Facades\LightLogs;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
class LoginController extends BaseController
 | 
					class LoginController extends BaseController
 | 
				
			||||||
@ -173,8 +170,7 @@ class LoginController extends BaseController
 | 
				
			|||||||
            $cu = CompanyUser::query()
 | 
					            $cu = CompanyUser::query()
 | 
				
			||||||
                  ->where('user_id', auth()->user()->id);
 | 
					                  ->where('user_id', auth()->user()->id);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
                return $this->listResponse($cu);
 | 
					            return $this->listResponse($cu);
 | 
				
			||||||
 | 
					 | 
				
			||||||
        } else {
 | 
					        } else {
 | 
				
			||||||
            LightLogs::create(new LoginFailure())
 | 
					            LightLogs::create(new LoginFailure())
 | 
				
			||||||
                ->increment()
 | 
					                ->increment()
 | 
				
			||||||
 | 
				
			|||||||
@ -12,7 +12,6 @@
 | 
				
			|||||||
namespace App\Http\Controllers\Auth;
 | 
					namespace App\Http\Controllers\Auth;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
use Illuminate\Foundation\Auth\VerifiesEmails;
 | 
					use Illuminate\Foundation\Auth\VerifiesEmails;
 | 
				
			||||||
use Illuminate\Http\Request;
 | 
					 | 
				
			||||||
use Illuminate\Routing\Controller;
 | 
					use Illuminate\Routing\Controller;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
class VerificationController extends Controller
 | 
					class VerificationController extends Controller
 | 
				
			||||||
 | 
				
			|||||||
@ -13,7 +13,6 @@ namespace App\Http\Controllers;
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
use App\Models\Account;
 | 
					use App\Models\Account;
 | 
				
			||||||
use App\Models\Company;
 | 
					use App\Models\Company;
 | 
				
			||||||
use App\Models\Design;
 | 
					 | 
				
			||||||
use App\Models\User;
 | 
					use App\Models\User;
 | 
				
			||||||
use App\Transformers\ArraySerializer;
 | 
					use App\Transformers\ArraySerializer;
 | 
				
			||||||
use App\Transformers\EntityTransformer;
 | 
					use App\Transformers\EntityTransformer;
 | 
				
			||||||
@ -23,9 +22,6 @@ use App\Utils\Traits\AppSetup;
 | 
				
			|||||||
use Illuminate\Contracts\Container\BindingResolutionException;
 | 
					use Illuminate\Contracts\Container\BindingResolutionException;
 | 
				
			||||||
use Illuminate\Database\Eloquent\Builder;
 | 
					use Illuminate\Database\Eloquent\Builder;
 | 
				
			||||||
use Illuminate\Http\Request;
 | 
					use Illuminate\Http\Request;
 | 
				
			||||||
use Illuminate\Support\Facades\Log;
 | 
					 | 
				
			||||||
use Illuminate\Support\Facades\Request as Input;
 | 
					 | 
				
			||||||
use Illuminate\Support\Facades\Schema;
 | 
					 | 
				
			||||||
use League\Fractal\Manager;
 | 
					use League\Fractal\Manager;
 | 
				
			||||||
use League\Fractal\Pagination\IlluminatePaginatorAdapter;
 | 
					use League\Fractal\Pagination\IlluminatePaginatorAdapter;
 | 
				
			||||||
use League\Fractal\Resource\Collection;
 | 
					use League\Fractal\Resource\Collection;
 | 
				
			||||||
@ -207,12 +203,12 @@ class BaseController extends Controller
 | 
				
			|||||||
        $updated_at = date('Y-m-d H:i:s', $updated_at);
 | 
					        $updated_at = date('Y-m-d H:i:s', $updated_at);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        $query->with(
 | 
					        $query->with(
 | 
				
			||||||
          [
 | 
					            [
 | 
				
			||||||
            'company' => function ($query) use ($updated_at) {
 | 
					            'company' => function ($query) use ($updated_at) {
 | 
				
			||||||
                $query->whereNotNull('updated_at')->with('documents');
 | 
					                $query->whereNotNull('updated_at')->with('documents');
 | 
				
			||||||
            },
 | 
					            },
 | 
				
			||||||
            'company.clients' => function ($query) use ($updated_at) {
 | 
					            'company.clients' => function ($query) use ($updated_at) {
 | 
				
			||||||
                $query->where('clients.updated_at', '>=', $updated_at)->with('contacts.company', 'gateway_tokens','documents');
 | 
					                $query->where('clients.updated_at', '>=', $updated_at)->with('contacts.company', 'gateway_tokens', 'documents');
 | 
				
			||||||
            },
 | 
					            },
 | 
				
			||||||
            'company.company_gateways' => function ($query) {
 | 
					            'company.company_gateways' => function ($query) {
 | 
				
			||||||
                $query->whereNotNull('updated_at');
 | 
					                $query->whereNotNull('updated_at');
 | 
				
			||||||
@ -236,7 +232,7 @@ class BaseController extends Controller
 | 
				
			|||||||
                $query->where('updated_at', '>=', $updated_at)->with('invitations', 'documents');
 | 
					                $query->where('updated_at', '>=', $updated_at)->with('invitations', 'documents');
 | 
				
			||||||
            },
 | 
					            },
 | 
				
			||||||
            'company.payments'=> function ($query) use ($updated_at) {
 | 
					            'company.payments'=> function ($query) use ($updated_at) {
 | 
				
			||||||
                $query->where('updated_at', '>=', $updated_at)->with('paymentables','documents');
 | 
					                $query->where('updated_at', '>=', $updated_at)->with('paymentables', 'documents');
 | 
				
			||||||
            },
 | 
					            },
 | 
				
			||||||
            'company.payment_terms'=> function ($query) use ($updated_at) {
 | 
					            'company.payment_terms'=> function ($query) use ($updated_at) {
 | 
				
			||||||
                $query->where('updated_at', '>=', $updated_at);
 | 
					                $query->where('updated_at', '>=', $updated_at);
 | 
				
			||||||
@ -245,7 +241,7 @@ class BaseController extends Controller
 | 
				
			|||||||
                $query->where('updated_at', '>=', $updated_at)->with('documents');
 | 
					                $query->where('updated_at', '>=', $updated_at)->with('documents');
 | 
				
			||||||
            },
 | 
					            },
 | 
				
			||||||
            'company.projects'=> function ($query) use ($updated_at) {
 | 
					            'company.projects'=> function ($query) use ($updated_at) {
 | 
				
			||||||
                $query->where('updated_at', '>=', $updated_at)->with('documents' );
 | 
					                $query->where('updated_at', '>=', $updated_at)->with('documents');
 | 
				
			||||||
            },
 | 
					            },
 | 
				
			||||||
            'company.quotes'=> function ($query) use ($updated_at) {
 | 
					            'company.quotes'=> function ($query) use ($updated_at) {
 | 
				
			||||||
                $query->where('updated_at', '>=', $updated_at)->with('invitations', 'documents');
 | 
					                $query->where('updated_at', '>=', $updated_at)->with('invitations', 'documents');
 | 
				
			||||||
@ -254,13 +250,13 @@ class BaseController extends Controller
 | 
				
			|||||||
                $query->where('updated_at', '>=', $updated_at)->with('invitations', 'documents');
 | 
					                $query->where('updated_at', '>=', $updated_at)->with('invitations', 'documents');
 | 
				
			||||||
            },
 | 
					            },
 | 
				
			||||||
            'company.tasks'=> function ($query) use ($updated_at) {
 | 
					            'company.tasks'=> function ($query) use ($updated_at) {
 | 
				
			||||||
                $query->where('updated_at', '>=', $updated_at)->with('documents' );
 | 
					                $query->where('updated_at', '>=', $updated_at)->with('documents');
 | 
				
			||||||
            },
 | 
					            },
 | 
				
			||||||
            'company.tax_rates' => function ($query) use ($updated_at) {
 | 
					            'company.tax_rates' => function ($query) use ($updated_at) {
 | 
				
			||||||
                $query->where('updated_at', '>=', $updated_at);
 | 
					                $query->where('updated_at', '>=', $updated_at);
 | 
				
			||||||
            },
 | 
					            },
 | 
				
			||||||
            'company.vendors'=> function ($query) use ($updated_at) {
 | 
					            'company.vendors'=> function ($query) use ($updated_at) {
 | 
				
			||||||
                $query->where('updated_at', '>=', $updated_at)->with('contacts','documents');
 | 
					                $query->where('updated_at', '>=', $updated_at)->with('contacts', 'documents');
 | 
				
			||||||
            },
 | 
					            },
 | 
				
			||||||
            'company.expense_categories'=> function ($query) use ($updated_at) {
 | 
					            'company.expense_categories'=> function ($query) use ($updated_at) {
 | 
				
			||||||
                $query->where('updated_at', '>=', $updated_at);
 | 
					                $query->where('updated_at', '>=', $updated_at);
 | 
				
			||||||
@ -297,14 +293,17 @@ class BaseController extends Controller
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
        $query->with($includes);
 | 
					        $query->with($includes);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        if (auth()->user() && ! auth()->user()->hasPermission('view_'.lcfirst(class_basename($this->entity_type)))) 
 | 
					        if (auth()->user() && ! auth()->user()->hasPermission('view_'.lcfirst(class_basename($this->entity_type)))) {
 | 
				
			||||||
            $query->where('user_id', '=', auth()->user()->id);
 | 
					            $query->where('user_id', '=', auth()->user()->id);
 | 
				
			||||||
 | 
					        }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        if (request()->has('updated_at') && request()->input('updated_at') > 0) 
 | 
					        if (request()->has('updated_at') && request()->input('updated_at') > 0) {
 | 
				
			||||||
            $query->where('updated_at', '>=', date('Y-m-d H:i:s', intval(request()->input('updated_at'))));
 | 
					            $query->where('updated_at', '>=', date('Y-m-d H:i:s', intval(request()->input('updated_at'))));
 | 
				
			||||||
 | 
					        }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        if ($this->serializer && $this->serializer != EntityTransformer::API_SERIALIZER_JSON) 
 | 
					        if ($this->serializer && $this->serializer != EntityTransformer::API_SERIALIZER_JSON) {
 | 
				
			||||||
            $this->entity_type = null;
 | 
					            $this->entity_type = null;
 | 
				
			||||||
 | 
					        }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        if ($query instanceof Builder) {
 | 
					        if ($query instanceof Builder) {
 | 
				
			||||||
            $limit = request()->input('per_page', 20);
 | 
					            $limit = request()->input('per_page', 20);
 | 
				
			||||||
@ -317,7 +316,6 @@ class BaseController extends Controller
 | 
				
			|||||||
        }
 | 
					        }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        return $this->response($this->manager->createData($resource)->toArray());
 | 
					        return $this->response($this->manager->createData($resource)->toArray());
 | 
				
			||||||
 | 
					 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    protected function response($response)
 | 
					    protected function response($response)
 | 
				
			||||||
@ -357,13 +355,15 @@ class BaseController extends Controller
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
        $transformer = new $this->entity_transformer(request()->input('serializer'));
 | 
					        $transformer = new $this->entity_transformer(request()->input('serializer'));
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        if ($this->serializer && $this->serializer != EntityTransformer::API_SERIALIZER_JSON) 
 | 
					        if ($this->serializer && $this->serializer != EntityTransformer::API_SERIALIZER_JSON) {
 | 
				
			||||||
            $this->entity_type = null;
 | 
					            $this->entity_type = null;
 | 
				
			||||||
 | 
					        }
 | 
				
			||||||
        
 | 
					        
 | 
				
			||||||
        $resource = new Item($item, $transformer, $this->entity_type);
 | 
					        $resource = new Item($item, $transformer, $this->entity_type);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        if (auth()->user() && request()->include_static) 
 | 
					        if (auth()->user() && request()->include_static) {
 | 
				
			||||||
            $data['static'] = Statics::company(auth()->user()->getCompany()->getLocale());
 | 
					            $data['static'] = Statics::company(auth()->user()->getCompany()->getLocale());
 | 
				
			||||||
 | 
					        }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        return $this->response($this->manager->createData($resource)->toArray());
 | 
					        return $this->response($this->manager->createData($resource)->toArray());
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
@ -407,7 +407,6 @@ class BaseController extends Controller
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
    public function flutterRoute()
 | 
					    public function flutterRoute()
 | 
				
			||||||
    {
 | 
					    {
 | 
				
			||||||
 | 
					 | 
				
			||||||
        if ((bool) $this->checkAppSetup() !== false && $account = Account::first()) {
 | 
					        if ((bool) $this->checkAppSetup() !== false && $account = Account::first()) {
 | 
				
			||||||
            if (config('ninja.require_https') && ! request()->isSecure()) {
 | 
					            if (config('ninja.require_https') && ! request()->isSecure()) {
 | 
				
			||||||
                return redirect()->secure(request()->getRequestUri());
 | 
					                return redirect()->secure(request()->getRequestUri());
 | 
				
			||||||
 | 
				
			|||||||
@ -11,12 +11,10 @@
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
namespace App\Http\Controllers;
 | 
					namespace App\Http\Controllers;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
use App\DataMapper\ClientSettings;
 | 
					 | 
				
			||||||
use App\Events\Client\ClientWasCreated;
 | 
					use App\Events\Client\ClientWasCreated;
 | 
				
			||||||
use App\Events\Client\ClientWasUpdated;
 | 
					use App\Events\Client\ClientWasUpdated;
 | 
				
			||||||
use App\Factory\ClientFactory;
 | 
					use App\Factory\ClientFactory;
 | 
				
			||||||
use App\Filters\ClientFilters;
 | 
					use App\Filters\ClientFilters;
 | 
				
			||||||
use App\Http\Requests\Client\BulkClientRequest;
 | 
					 | 
				
			||||||
use App\Http\Requests\Client\CreateClientRequest;
 | 
					use App\Http\Requests\Client\CreateClientRequest;
 | 
				
			||||||
use App\Http\Requests\Client\DestroyClientRequest;
 | 
					use App\Http\Requests\Client\DestroyClientRequest;
 | 
				
			||||||
use App\Http\Requests\Client\EditClientRequest;
 | 
					use App\Http\Requests\Client\EditClientRequest;
 | 
				
			||||||
@ -25,15 +23,7 @@ use App\Http\Requests\Client\StoreClientRequest;
 | 
				
			|||||||
use App\Http\Requests\Client\UpdateClientRequest;
 | 
					use App\Http\Requests\Client\UpdateClientRequest;
 | 
				
			||||||
use App\Jobs\Client\StoreClient;
 | 
					use App\Jobs\Client\StoreClient;
 | 
				
			||||||
use App\Jobs\Client\UpdateClient;
 | 
					use App\Jobs\Client\UpdateClient;
 | 
				
			||||||
use App\Jobs\Entity\ActionEntity;
 | 
					 | 
				
			||||||
use App\Jobs\Util\ProcessBulk;
 | 
					 | 
				
			||||||
use App\Jobs\Util\UploadAvatar;
 | 
					 | 
				
			||||||
use App\Models\Client;
 | 
					use App\Models\Client;
 | 
				
			||||||
use App\Models\ClientContact;
 | 
					 | 
				
			||||||
use App\Models\Country;
 | 
					 | 
				
			||||||
use App\Models\Currency;
 | 
					 | 
				
			||||||
use App\Models\Size;
 | 
					 | 
				
			||||||
use App\Repositories\BaseRepository;
 | 
					 | 
				
			||||||
use App\Repositories\ClientRepository;
 | 
					use App\Repositories\ClientRepository;
 | 
				
			||||||
use App\Transformers\ClientTransformer;
 | 
					use App\Transformers\ClientTransformer;
 | 
				
			||||||
use App\Utils\Ninja;
 | 
					use App\Utils\Ninja;
 | 
				
			||||||
@ -42,8 +32,6 @@ use App\Utils\Traits\MakesHash;
 | 
				
			|||||||
use App\Utils\Traits\Uploadable;
 | 
					use App\Utils\Traits\Uploadable;
 | 
				
			||||||
use Illuminate\Http\Request;
 | 
					use Illuminate\Http\Request;
 | 
				
			||||||
use Illuminate\Http\Response;
 | 
					use Illuminate\Http\Response;
 | 
				
			||||||
use Illuminate\Support\Facades\Cache;
 | 
					 | 
				
			||||||
use Illuminate\Support\Facades\Log;
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
/**
 | 
					/**
 | 
				
			||||||
 * Class ClientController.
 | 
					 * Class ClientController.
 | 
				
			||||||
 | 
				
			|||||||
@ -13,7 +13,6 @@ namespace App\Http\Controllers\ClientPortal;
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
use App\Http\Controllers\Controller;
 | 
					use App\Http\Controllers\Controller;
 | 
				
			||||||
use Auth;
 | 
					use Auth;
 | 
				
			||||||
use Illuminate\Http\Request;
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
class ContactHashLoginController extends Controller
 | 
					class ContactHashLoginController extends Controller
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
@ -25,11 +24,6 @@ class ContactHashLoginController extends Controller
 | 
				
			|||||||
     */
 | 
					     */
 | 
				
			||||||
    public function login(string $contact_key)
 | 
					    public function login(string $contact_key)
 | 
				
			||||||
    {
 | 
					    {
 | 
				
			||||||
 | 
					 | 
				
			||||||
        return redirect('/client/login');
 | 
					        return redirect('/client/login');
 | 
				
			||||||
 | 
					 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
					 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
    
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
 | 
				
			|||||||
@ -6,7 +6,6 @@ use App\Http\Controllers\Controller;
 | 
				
			|||||||
use App\Http\Requests\ClientPortal\ShowCreditRequest;
 | 
					use App\Http\Requests\ClientPortal\ShowCreditRequest;
 | 
				
			||||||
use App\Models\Credit;
 | 
					use App\Models\Credit;
 | 
				
			||||||
use Illuminate\Contracts\View\Factory;
 | 
					use Illuminate\Contracts\View\Factory;
 | 
				
			||||||
use Illuminate\Http\Request;
 | 
					 | 
				
			||||||
use Illuminate\View\View;
 | 
					use Illuminate\View\View;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
class CreditController extends Controller
 | 
					class CreditController extends Controller
 | 
				
			||||||
 | 
				
			|||||||
@ -13,7 +13,6 @@ namespace App\Http\Controllers\ClientPortal;
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
use App\Http\Controllers\Controller;
 | 
					use App\Http\Controllers\Controller;
 | 
				
			||||||
use Illuminate\Contracts\View\Factory;
 | 
					use Illuminate\Contracts\View\Factory;
 | 
				
			||||||
use Illuminate\Http\Request;
 | 
					 | 
				
			||||||
use Illuminate\View\View;
 | 
					use Illuminate\View\View;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
class DashboardController extends Controller
 | 
					class DashboardController extends Controller
 | 
				
			||||||
 | 
				
			|||||||
@ -3,7 +3,6 @@
 | 
				
			|||||||
namespace App\Http\Controllers\ClientPortal;
 | 
					namespace App\Http\Controllers\ClientPortal;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
use App\Http\Controllers\Controller;
 | 
					use App\Http\Controllers\Controller;
 | 
				
			||||||
use App\Models\Invoice;
 | 
					 | 
				
			||||||
use App\Utils\Traits\MakesHash;
 | 
					use App\Utils\Traits\MakesHash;
 | 
				
			||||||
use Illuminate\Contracts\View\Factory;
 | 
					use Illuminate\Contracts\View\Factory;
 | 
				
			||||||
use Illuminate\Http\RedirectResponse;
 | 
					use Illuminate\Http\RedirectResponse;
 | 
				
			||||||
 | 
				
			|||||||
@ -16,10 +16,6 @@ use App\Events\Invoice\InvoiceWasViewed;
 | 
				
			|||||||
use App\Events\Misc\InvitationWasViewed;
 | 
					use App\Events\Misc\InvitationWasViewed;
 | 
				
			||||||
use App\Events\Quote\QuoteWasViewed;
 | 
					use App\Events\Quote\QuoteWasViewed;
 | 
				
			||||||
use App\Http\Controllers\Controller;
 | 
					use App\Http\Controllers\Controller;
 | 
				
			||||||
use App\Models\InvoiceInvitation;
 | 
					 | 
				
			||||||
use App\Models\QuoteInvitation;
 | 
					 | 
				
			||||||
use App\Models\CreditInvitation;
 | 
					 | 
				
			||||||
use App\Models\RecurringInvoiceInvitation;
 | 
					 | 
				
			||||||
use App\Utils\Ninja;
 | 
					use App\Utils\Ninja;
 | 
				
			||||||
use App\Utils\Traits\MakesDates;
 | 
					use App\Utils\Traits\MakesDates;
 | 
				
			||||||
use App\Utils\Traits\MakesHash;
 | 
					use App\Utils\Traits\MakesHash;
 | 
				
			||||||
@ -37,7 +33,6 @@ class InvitationController extends Controller
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
    public function router(string $entity, string $invitation_key)
 | 
					    public function router(string $entity, string $invitation_key)
 | 
				
			||||||
    {
 | 
					    {
 | 
				
			||||||
 | 
					 | 
				
			||||||
        $key = $entity.'_id';
 | 
					        $key = $entity.'_id';
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        $entity_obj = 'App\Models\\'.ucfirst(Str::camel($entity)).'Invitation';
 | 
					        $entity_obj = 'App\Models\\'.ucfirst(Str::camel($entity)).'Invitation';
 | 
				
			||||||
@ -48,18 +43,15 @@ class InvitationController extends Controller
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
        /* Return early if we have the correct client_hash embedded */
 | 
					        /* Return early if we have the correct client_hash embedded */
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        if(request()->has('client_hash') && request()->input('client_hash') == $invitation->contact->client->client_hash) {
 | 
					        if (request()->has('client_hash') && request()->input('client_hash') == $invitation->contact->client->client_hash) {
 | 
				
			||||||
            auth()->guard('contact')->login($invitation->contact, true);
 | 
					            auth()->guard('contact')->login($invitation->contact, true);
 | 
				
			||||||
        }
 | 
					        } elseif ((bool) $invitation->contact->client->getSetting('enable_client_portal_password') !== false) {
 | 
				
			||||||
        else if ((bool) $invitation->contact->client->getSetting('enable_client_portal_password') !== false) {
 | 
					 | 
				
			||||||
            $this->middleware('auth:contact');
 | 
					            $this->middleware('auth:contact');
 | 
				
			||||||
        } 
 | 
					        } else {
 | 
				
			||||||
        else {
 | 
					 | 
				
			||||||
            auth()->guard('contact')->login($invitation->contact, true);
 | 
					            auth()->guard('contact')->login($invitation->contact, true);
 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        if (auth()->guard('contact') && ! request()->has('silent') && ! $invitation->viewed_date) {
 | 
					        if (auth()->guard('contact') && ! request()->has('silent') && ! $invitation->viewed_date) {
 | 
				
			||||||
 | 
					 | 
				
			||||||
            $invitation->markViewed();
 | 
					            $invitation->markViewed();
 | 
				
			||||||
 | 
					
 | 
				
			||||||
            event(new InvitationWasViewed($invitation->{$entity}, $invitation, $invitation->{$entity}->company, Ninja::eventVars()));
 | 
					            event(new InvitationWasViewed($invitation->{$entity}, $invitation, $invitation->{$entity}->company, Ninja::eventVars()));
 | 
				
			||||||
@ -68,8 +60,6 @@ class InvitationController extends Controller
 | 
				
			|||||||
        }
 | 
					        }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        return redirect()->route('client.'.$entity.'.show', [$entity => $this->encodePrimaryKey($invitation->{$key})]);
 | 
					        return redirect()->route('client.'.$entity.'.show', [$entity => $this->encodePrimaryKey($invitation->{$key})]);
 | 
				
			||||||
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    private function fireEntityViewedEvent($invitation, $entity_string)
 | 
					    private function fireEntityViewedEvent($invitation, $entity_string)
 | 
				
			||||||
 | 
				
			|||||||
@ -77,8 +77,9 @@ class PaymentController extends Controller
 | 
				
			|||||||
        $is_credit_payment = false;
 | 
					        $is_credit_payment = false;
 | 
				
			||||||
        $token = false;
 | 
					        $token = false;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        if($request->input('company_gateway_id') == CompanyGateway::GATEWAY_CREDIT)
 | 
					        if ($request->input('company_gateway_id') == CompanyGateway::GATEWAY_CREDIT) {
 | 
				
			||||||
            $is_credit_payment = true;
 | 
					            $is_credit_payment = true;
 | 
				
			||||||
 | 
					        }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        $gateway = CompanyGateway::find($request->input('company_gateway_id'));
 | 
					        $gateway = CompanyGateway::find($request->input('company_gateway_id'));
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@ -94,10 +95,8 @@ class PaymentController extends Controller
 | 
				
			|||||||
        $invoices = Invoice::whereIn('id', $this->transformKeys($payable_invoices->pluck('invoice_id')->toArray()))->get();
 | 
					        $invoices = Invoice::whereIn('id', $this->transformKeys($payable_invoices->pluck('invoice_id')->toArray()))->get();
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        /* pop non payable invoice from the $payable_invoices array */
 | 
					        /* pop non payable invoice from the $payable_invoices array */
 | 
				
			||||||
        $payable_invoices = $payable_invoices->filter(function ($payable_invoice) use ($invoices){
 | 
					        $payable_invoices = $payable_invoices->filter(function ($payable_invoice) use ($invoices) {
 | 
				
			||||||
 | 
					 | 
				
			||||||
            return $invoices->where('hashed_id', $payable_invoice['invoice_id'])->first()->isPayable();
 | 
					            return $invoices->where('hashed_id', $payable_invoice['invoice_id'])->first()->isPayable();
 | 
				
			||||||
 | 
					 | 
				
			||||||
        });
 | 
					        });
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        /*return early if no invoices*/
 | 
					        /*return early if no invoices*/
 | 
				
			||||||
@ -110,8 +109,7 @@ class PaymentController extends Controller
 | 
				
			|||||||
        $settings = auth()->user()->client->getMergedSettings();
 | 
					        $settings = auth()->user()->client->getMergedSettings();
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        /*iterate through invoices and add gateway fees and other payment metadata*/
 | 
					        /*iterate through invoices and add gateway fees and other payment metadata*/
 | 
				
			||||||
        $payable_invoices = $payable_invoices->map(function($payable_invoice) use($invoices, $settings){
 | 
					        $payable_invoices = $payable_invoices->map(function ($payable_invoice) use ($invoices, $settings) {
 | 
				
			||||||
 | 
					 | 
				
			||||||
            $payable_invoice['amount'] = Number::parseFloat($payable_invoice['amount']);
 | 
					            $payable_invoice['amount'] = Number::parseFloat($payable_invoice['amount']);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
            $invoice = $invoices->first(function ($inv) use ($payable_invoice) {
 | 
					            $invoice = $invoices->first(function ($inv) use ($payable_invoice) {
 | 
				
			||||||
@ -167,7 +165,6 @@ class PaymentController extends Controller
 | 
				
			|||||||
            $payable_invoice['additional_info'] = $additional_info;
 | 
					            $payable_invoice['additional_info'] = $additional_info;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
            return $payable_invoice;
 | 
					            return $payable_invoice;
 | 
				
			||||||
 | 
					 | 
				
			||||||
        });
 | 
					        });
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        if (request()->has('signature') && !is_null(request()->signature) && !empty(request()->signature)) {
 | 
					        if (request()->has('signature') && !is_null(request()->signature) && !empty(request()->signature)) {
 | 
				
			||||||
@ -182,8 +179,9 @@ class PaymentController extends Controller
 | 
				
			|||||||
        $credit_totals = $first_invoice->client->getSetting('use_credits_payment') == 'off' ? 0 : $first_invoice->client->service()->getCreditBalance();
 | 
					        $credit_totals = $first_invoice->client->getSetting('use_credits_payment') == 'off' ? 0 : $first_invoice->client->service()->getCreditBalance();
 | 
				
			||||||
        $starting_invoice_amount = $first_invoice->amount;
 | 
					        $starting_invoice_amount = $first_invoice->amount;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        if($gateway)
 | 
					        if ($gateway) {
 | 
				
			||||||
            $first_invoice->service()->addGatewayFee($gateway, $payment_method_id, $invoice_totals)->save();
 | 
					            $first_invoice->service()->addGatewayFee($gateway, $payment_method_id, $invoice_totals)->save();
 | 
				
			||||||
 | 
					        }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        /**
 | 
					        /**
 | 
				
			||||||
         * Gateway fee is calculated
 | 
					         * Gateway fee is calculated
 | 
				
			||||||
@ -192,8 +190,9 @@ class PaymentController extends Controller
 | 
				
			|||||||
         */
 | 
					         */
 | 
				
			||||||
        $fee_totals = $first_invoice->amount - $starting_invoice_amount;
 | 
					        $fee_totals = $first_invoice->amount - $starting_invoice_amount;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        if($gateway)
 | 
					        if ($gateway) {
 | 
				
			||||||
            $token = auth()->user()->client->gateway_token($gateway->id, $payment_method_id);
 | 
					            $token = auth()->user()->client->gateway_token($gateway->id, $payment_method_id);
 | 
				
			||||||
 | 
					        }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        $payment_hash = new PaymentHash;
 | 
					        $payment_hash = new PaymentHash;
 | 
				
			||||||
        $payment_hash->hash = Str::random(128);
 | 
					        $payment_hash->hash = Str::random(128);
 | 
				
			||||||
@ -218,7 +217,7 @@ class PaymentController extends Controller
 | 
				
			|||||||
            'amount_with_fee' => $invoice_totals + $fee_totals,
 | 
					            'amount_with_fee' => $invoice_totals + $fee_totals,
 | 
				
			||||||
        ];
 | 
					        ];
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        if($is_credit_payment) {
 | 
					        if ($is_credit_payment) {
 | 
				
			||||||
            return $this->processCreditPayment($request, $data);
 | 
					            return $this->processCreditPayment($request, $data);
 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@ -252,9 +251,9 @@ class PaymentController extends Controller
 | 
				
			|||||||
        $payment_hash = PaymentHash::whereRaw('BINARY `hash`= ?', [$request->input('payment_hash')])->first();
 | 
					        $payment_hash = PaymentHash::whereRaw('BINARY `hash`= ?', [$request->input('payment_hash')])->first();
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        /* Hydrate the $payment */
 | 
					        /* Hydrate the $payment */
 | 
				
			||||||
        if($payment_hash->payment()->exists())
 | 
					        if ($payment_hash->payment()->exists()) {
 | 
				
			||||||
            $payment = $payment_hash->payment;
 | 
					            $payment = $payment_hash->payment;
 | 
				
			||||||
        else {
 | 
					        } else {
 | 
				
			||||||
            $payment = PaymentFactory::create($payment_hash->fee_invoice->company_id, $payment_hash->fee_invoice->user_id);
 | 
					            $payment = PaymentFactory::create($payment_hash->fee_invoice->company_id, $payment_hash->fee_invoice->user_id);
 | 
				
			||||||
            $payment->client_id = $payment_hash->fee_invoice->client_id;
 | 
					            $payment->client_id = $payment_hash->fee_invoice->client_id;
 | 
				
			||||||
            $payment->save();
 | 
					            $payment->save();
 | 
				
			||||||
@ -264,8 +263,7 @@ class PaymentController extends Controller
 | 
				
			|||||||
        }
 | 
					        }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        /* Iterate through the invoices and apply credits to them */
 | 
					        /* Iterate through the invoices and apply credits to them */
 | 
				
			||||||
        collect($payment_hash->invoices())->each(function ($payable_invoice) use ($payment, $payment_hash){
 | 
					        collect($payment_hash->invoices())->each(function ($payable_invoice) use ($payment, $payment_hash) {
 | 
				
			||||||
 | 
					 | 
				
			||||||
            $invoice = Invoice::find($this->decodePrimaryKey($payable_invoice->invoice_id));
 | 
					            $invoice = Invoice::find($this->decodePrimaryKey($payable_invoice->invoice_id));
 | 
				
			||||||
            $amount = $payable_invoice->amount;
 | 
					            $amount = $payable_invoice->amount;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@ -274,35 +272,31 @@ class PaymentController extends Controller
 | 
				
			|||||||
                                    ->service()
 | 
					                                    ->service()
 | 
				
			||||||
                                    ->getCredits();
 | 
					                                    ->getCredits();
 | 
				
			||||||
 | 
					
 | 
				
			||||||
                foreach($credits as $credit)
 | 
					            foreach ($credits as $credit) {
 | 
				
			||||||
                {
 | 
					                //starting invoice balance
 | 
				
			||||||
                    //starting invoice balance
 | 
					                $invoice_balance = $invoice->balance;
 | 
				
			||||||
                    $invoice_balance = $invoice->balance;
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
                    //credit payment applied
 | 
					                //credit payment applied
 | 
				
			||||||
                    $credit->service()->applyPayment($invoice, $amount, $payment);
 | 
					                $credit->service()->applyPayment($invoice, $amount, $payment);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
                    //amount paid from invoice calculated
 | 
					                //amount paid from invoice calculated
 | 
				
			||||||
                    $remaining_balance = ($invoice_balance - $invoice->fresh()->balance);
 | 
					                $remaining_balance = ($invoice_balance - $invoice->fresh()->balance);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
                    //reduce the amount to be paid on the invoice from the NEXT credit
 | 
					                //reduce the amount to be paid on the invoice from the NEXT credit
 | 
				
			||||||
                    $amount -= $remaining_balance;
 | 
					                $amount -= $remaining_balance;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
                    //break if the invoice is no longer PAYABLE OR there is no more amount to be applied
 | 
					                //break if the invoice is no longer PAYABLE OR there is no more amount to be applied
 | 
				
			||||||
                    if(!$invoice->isPayable() || (int)$amount == 0)
 | 
					                if (!$invoice->isPayable() || (int)$amount == 0) {
 | 
				
			||||||
                        break;
 | 
					                    break;
 | 
				
			||||||
                }
 | 
					                }
 | 
				
			||||||
 | 
					            }
 | 
				
			||||||
        });
 | 
					        });
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        return redirect()->route('client.payments.show', ['payment' => $this->encodePrimaryKey($payment->id)]);
 | 
					        return redirect()->route('client.payments.show', ['payment' => $this->encodePrimaryKey($payment->id)]);
 | 
				
			||||||
 | 
					 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    public function processCreditPayment(Request $request, array $data)
 | 
					    public function processCreditPayment(Request $request, array $data)
 | 
				
			||||||
    {
 | 
					    {
 | 
				
			||||||
 | 
					 | 
				
			||||||
        return render('gateways.credit.index', $data);
 | 
					        return render('gateways.credit.index', $data);
 | 
				
			||||||
 | 
					 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
				
			|||||||
@ -17,9 +17,7 @@ use App\Http\Controllers\Controller;
 | 
				
			|||||||
use App\Http\Requests\ClientPortal\CreatePaymentMethodRequest;
 | 
					use App\Http\Requests\ClientPortal\CreatePaymentMethodRequest;
 | 
				
			||||||
use App\Http\Requests\Request;
 | 
					use App\Http\Requests\Request;
 | 
				
			||||||
use App\Models\ClientGatewayToken;
 | 
					use App\Models\ClientGatewayToken;
 | 
				
			||||||
use App\Models\CompanyGateway;
 | 
					 | 
				
			||||||
use App\Models\GatewayType;
 | 
					use App\Models\GatewayType;
 | 
				
			||||||
use App\PaymentDrivers\AuthorizePaymentDriver;
 | 
					 | 
				
			||||||
use App\Utils\Ninja;
 | 
					use App\Utils\Ninja;
 | 
				
			||||||
use App\Utils\Traits\MakesDates;
 | 
					use App\Utils\Traits\MakesDates;
 | 
				
			||||||
use Exception;
 | 
					use Exception;
 | 
				
			||||||
 | 
				
			|||||||
@ -18,9 +18,6 @@ use App\Jobs\Util\UploadAvatar;
 | 
				
			|||||||
use App\Models\ClientContact;
 | 
					use App\Models\ClientContact;
 | 
				
			||||||
use Illuminate\Contracts\View\Factory;
 | 
					use Illuminate\Contracts\View\Factory;
 | 
				
			||||||
use Illuminate\Http\RedirectResponse;
 | 
					use Illuminate\Http\RedirectResponse;
 | 
				
			||||||
use Illuminate\Http\Request;
 | 
					 | 
				
			||||||
use Illuminate\Support\Facades\Hash;
 | 
					 | 
				
			||||||
use Illuminate\Support\Facades\Log;
 | 
					 | 
				
			||||||
use Illuminate\View\View;
 | 
					use Illuminate\View\View;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
class ProfileController extends Controller
 | 
					class ProfileController extends Controller
 | 
				
			||||||
 | 
				
			|||||||
@ -7,7 +7,6 @@ use App\Http\Controllers\Controller;
 | 
				
			|||||||
use App\Http\Requests\ClientPortal\ProcessQuotesInBulkRequest;
 | 
					use App\Http\Requests\ClientPortal\ProcessQuotesInBulkRequest;
 | 
				
			||||||
use App\Http\Requests\ClientPortal\ShowQuoteRequest;
 | 
					use App\Http\Requests\ClientPortal\ShowQuoteRequest;
 | 
				
			||||||
use App\Jobs\Invoice\InjectSignature;
 | 
					use App\Jobs\Invoice\InjectSignature;
 | 
				
			||||||
use App\Models\Company;
 | 
					 | 
				
			||||||
use App\Models\Quote;
 | 
					use App\Models\Quote;
 | 
				
			||||||
use App\Utils\Ninja;
 | 
					use App\Utils\Ninja;
 | 
				
			||||||
use App\Utils\TempFile;
 | 
					use App\Utils\TempFile;
 | 
				
			||||||
 | 
				
			|||||||
@ -20,19 +20,14 @@ use App\Http\Requests\Company\EditCompanyRequest;
 | 
				
			|||||||
use App\Http\Requests\Company\ShowCompanyRequest;
 | 
					use App\Http\Requests\Company\ShowCompanyRequest;
 | 
				
			||||||
use App\Http\Requests\Company\StoreCompanyRequest;
 | 
					use App\Http\Requests\Company\StoreCompanyRequest;
 | 
				
			||||||
use App\Http\Requests\Company\UpdateCompanyRequest;
 | 
					use App\Http\Requests\Company\UpdateCompanyRequest;
 | 
				
			||||||
use App\Http\Requests\SignupRequest;
 | 
					 | 
				
			||||||
use App\Jobs\Company\CreateCompany;
 | 
					use App\Jobs\Company\CreateCompany;
 | 
				
			||||||
use App\Jobs\Company\CreateCompanyPaymentTerms;
 | 
					use App\Jobs\Company\CreateCompanyPaymentTerms;
 | 
				
			||||||
use App\Jobs\Company\CreateCompanyTaskStatuses;
 | 
					use App\Jobs\Company\CreateCompanyTaskStatuses;
 | 
				
			||||||
use App\Jobs\Company\CreateCompanyToken;
 | 
					use App\Jobs\Company\CreateCompanyToken;
 | 
				
			||||||
use App\Jobs\Ninja\RefundCancelledAccount;
 | 
					use App\Jobs\Ninja\RefundCancelledAccount;
 | 
				
			||||||
use App\Jobs\RegisterNewAccount;
 | 
					 | 
				
			||||||
use App\Jobs\Util\UploadAvatar;
 | 
					 | 
				
			||||||
use App\Models\Account;
 | 
					 | 
				
			||||||
use App\Models\Company;
 | 
					use App\Models\Company;
 | 
				
			||||||
use App\Models\CompanyUser;
 | 
					use App\Models\CompanyUser;
 | 
				
			||||||
use App\Repositories\CompanyRepository;
 | 
					use App\Repositories\CompanyRepository;
 | 
				
			||||||
use App\Transformers\AccountTransformer;
 | 
					 | 
				
			||||||
use App\Transformers\CompanyTransformer;
 | 
					use App\Transformers\CompanyTransformer;
 | 
				
			||||||
use App\Transformers\CompanyUserTransformer;
 | 
					use App\Transformers\CompanyUserTransformer;
 | 
				
			||||||
use App\Utils\Ninja;
 | 
					use App\Utils\Ninja;
 | 
				
			||||||
@ -42,7 +37,6 @@ use Illuminate\Foundation\Bus\DispatchesJobs;
 | 
				
			|||||||
use Illuminate\Http\Request;
 | 
					use Illuminate\Http\Request;
 | 
				
			||||||
use Illuminate\Http\Response;
 | 
					use Illuminate\Http\Response;
 | 
				
			||||||
use Illuminate\Support\Facades\Auth;
 | 
					use Illuminate\Support\Facades\Auth;
 | 
				
			||||||
use Illuminate\Support\Facades\Hash;
 | 
					 | 
				
			||||||
use Turbo124\Beacon\Facades\LightLogs;
 | 
					use Turbo124\Beacon\Facades\LightLogs;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
/**
 | 
					/**
 | 
				
			||||||
@ -408,9 +402,9 @@ class CompanyController extends BaseController
 | 
				
			|||||||
     */
 | 
					     */
 | 
				
			||||||
    public function update(UpdateCompanyRequest $request, Company $company)
 | 
					    public function update(UpdateCompanyRequest $request, Company $company)
 | 
				
			||||||
    {
 | 
					    {
 | 
				
			||||||
        
 | 
					        if ($request->hasFile('company_logo') || (is_array($request->input('settings')) && !array_key_exists('company_logo', $request->input('settings')))) {
 | 
				
			||||||
        if($request->hasFile('company_logo') || (is_array($request->input('settings')) && !array_key_exists('company_logo', $request->input('settings'))))
 | 
					 | 
				
			||||||
            $this->removeLogo($company);
 | 
					            $this->removeLogo($company);
 | 
				
			||||||
 | 
					        }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        $company = $this->company_repo->save($request->all(), $company);
 | 
					        $company = $this->company_repo->save($request->all(), $company);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@ -490,7 +484,6 @@ class CompanyController extends BaseController
 | 
				
			|||||||
            LightLogs::create(new AccountDeleted())
 | 
					            LightLogs::create(new AccountDeleted())
 | 
				
			||||||
                     ->increment()
 | 
					                     ->increment()
 | 
				
			||||||
                     ->batch();
 | 
					                     ->batch();
 | 
				
			||||||
 | 
					 | 
				
			||||||
        } else {
 | 
					        } else {
 | 
				
			||||||
            $company_id = $company->id;
 | 
					            $company_id = $company->id;
 | 
				
			||||||
            $company->delete();
 | 
					            $company->delete();
 | 
				
			||||||
 | 
				
			|||||||
@ -18,7 +18,6 @@ use App\Http\Requests\CompanyGateway\EditCompanyGatewayRequest;
 | 
				
			|||||||
use App\Http\Requests\CompanyGateway\ShowCompanyGatewayRequest;
 | 
					use App\Http\Requests\CompanyGateway\ShowCompanyGatewayRequest;
 | 
				
			||||||
use App\Http\Requests\CompanyGateway\StoreCompanyGatewayRequest;
 | 
					use App\Http\Requests\CompanyGateway\StoreCompanyGatewayRequest;
 | 
				
			||||||
use App\Http\Requests\CompanyGateway\UpdateCompanyGatewayRequest;
 | 
					use App\Http\Requests\CompanyGateway\UpdateCompanyGatewayRequest;
 | 
				
			||||||
use App\Http\Requests\SignupRequest;
 | 
					 | 
				
			||||||
use App\Models\CompanyGateway;
 | 
					use App\Models\CompanyGateway;
 | 
				
			||||||
use App\Repositories\CompanyRepository;
 | 
					use App\Repositories\CompanyRepository;
 | 
				
			||||||
use App\Transformers\CompanyGatewayTransformer;
 | 
					use App\Transformers\CompanyGatewayTransformer;
 | 
				
			||||||
 | 
				
			|||||||
@ -14,7 +14,6 @@ namespace App\Http\Controllers;
 | 
				
			|||||||
use App\Http\Requests\CompanyLedger\ShowCompanyLedgerRequest;
 | 
					use App\Http\Requests\CompanyLedger\ShowCompanyLedgerRequest;
 | 
				
			||||||
use App\Models\CompanyLedger;
 | 
					use App\Models\CompanyLedger;
 | 
				
			||||||
use App\Transformers\CompanyLedgerTransformer;
 | 
					use App\Transformers\CompanyLedgerTransformer;
 | 
				
			||||||
use Illuminate\Http\Request;
 | 
					 | 
				
			||||||
use Illuminate\Http\Response;
 | 
					use Illuminate\Http\Response;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
class CompanyLedgerController extends BaseController
 | 
					class CompanyLedgerController extends BaseController
 | 
				
			||||||
 | 
				
			|||||||
@ -16,7 +16,6 @@ use App\Http\Requests\CompanyUser\UpdateCompanyUserRequest;
 | 
				
			|||||||
use App\Models\CompanyUser;
 | 
					use App\Models\CompanyUser;
 | 
				
			||||||
use App\Models\User;
 | 
					use App\Models\User;
 | 
				
			||||||
use App\Transformers\CompanyUserTransformer;
 | 
					use App\Transformers\CompanyUserTransformer;
 | 
				
			||||||
use Illuminate\Http\Request;
 | 
					 | 
				
			||||||
use Illuminate\Http\Response;
 | 
					use Illuminate\Http\Response;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
class CompanyUserController extends BaseController
 | 
					class CompanyUserController extends BaseController
 | 
				
			||||||
 | 
				
			|||||||
@ -16,7 +16,6 @@ use App\Http\Controllers\BaseController;
 | 
				
			|||||||
use App\Models\Invoice;
 | 
					use App\Models\Invoice;
 | 
				
			||||||
use App\Transformers\Contact\InvoiceTransformer;
 | 
					use App\Transformers\Contact\InvoiceTransformer;
 | 
				
			||||||
use App\Utils\Traits\MakesHash;
 | 
					use App\Utils\Traits\MakesHash;
 | 
				
			||||||
use Illuminate\Http\Request;
 | 
					 | 
				
			||||||
use Illuminate\Http\Response;
 | 
					use Illuminate\Http\Response;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
class InvoiceController extends BaseController
 | 
					class InvoiceController extends BaseController
 | 
				
			||||||
 | 
				
			|||||||
@ -19,12 +19,10 @@ use App\Libraries\OAuth\OAuth;
 | 
				
			|||||||
use App\Models\ClientContact;
 | 
					use App\Models\ClientContact;
 | 
				
			||||||
use App\Models\User;
 | 
					use App\Models\User;
 | 
				
			||||||
use App\Transformers\ClientContactLoginTransformer;
 | 
					use App\Transformers\ClientContactLoginTransformer;
 | 
				
			||||||
use App\Transformers\UserTransformer;
 | 
					 | 
				
			||||||
use App\Utils\Traits\UserSessionAttributes;
 | 
					use App\Utils\Traits\UserSessionAttributes;
 | 
				
			||||||
use Illuminate\Foundation\Auth\AuthenticatesUsers;
 | 
					use Illuminate\Foundation\Auth\AuthenticatesUsers;
 | 
				
			||||||
use Illuminate\Http\Request;
 | 
					use Illuminate\Http\Request;
 | 
				
			||||||
use Illuminate\Support\Facades\Auth;
 | 
					use Illuminate\Support\Facades\Auth;
 | 
				
			||||||
use Illuminate\Support\Facades\Log;
 | 
					 | 
				
			||||||
use Laravel\Socialite\Facades\Socialite;
 | 
					use Laravel\Socialite\Facades\Socialite;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
class LoginController extends BaseController
 | 
					class LoginController extends BaseController
 | 
				
			||||||
 | 
				
			|||||||
@ -11,7 +11,6 @@
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
namespace App\Http\Controllers;
 | 
					namespace App\Http\Controllers;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
use App\Utils\Traits\UserSessionAttributes;
 | 
					 | 
				
			||||||
use Illuminate\Contracts\View\Factory;
 | 
					use Illuminate\Contracts\View\Factory;
 | 
				
			||||||
use Illuminate\Foundation\Auth\Access\AuthorizesRequests;
 | 
					use Illuminate\Foundation\Auth\Access\AuthorizesRequests;
 | 
				
			||||||
use Illuminate\Foundation\Bus\DispatchesJobs;
 | 
					use Illuminate\Foundation\Bus\DispatchesJobs;
 | 
				
			||||||
 | 
				
			|||||||
@ -5,7 +5,6 @@ namespace App\Http\Controllers;
 | 
				
			|||||||
use App\Events\Credit\CreditWasCreated;
 | 
					use App\Events\Credit\CreditWasCreated;
 | 
				
			||||||
use App\Events\Credit\CreditWasUpdated;
 | 
					use App\Events\Credit\CreditWasUpdated;
 | 
				
			||||||
use App\Factory\CloneCreditFactory;
 | 
					use App\Factory\CloneCreditFactory;
 | 
				
			||||||
use App\Factory\CloneCreditToQuoteFactory;
 | 
					 | 
				
			||||||
use App\Factory\CreditFactory;
 | 
					use App\Factory\CreditFactory;
 | 
				
			||||||
use App\Filters\CreditFilters;
 | 
					use App\Filters\CreditFilters;
 | 
				
			||||||
use App\Http\Requests\Credit\ActionCreditRequest;
 | 
					use App\Http\Requests\Credit\ActionCreditRequest;
 | 
				
			||||||
@ -15,10 +14,8 @@ use App\Http\Requests\Credit\EditCreditRequest;
 | 
				
			|||||||
use App\Http\Requests\Credit\ShowCreditRequest;
 | 
					use App\Http\Requests\Credit\ShowCreditRequest;
 | 
				
			||||||
use App\Http\Requests\Credit\StoreCreditRequest;
 | 
					use App\Http\Requests\Credit\StoreCreditRequest;
 | 
				
			||||||
use App\Http\Requests\Credit\UpdateCreditRequest;
 | 
					use App\Http\Requests\Credit\UpdateCreditRequest;
 | 
				
			||||||
use App\Http\Requests\Invoice\EditInvoiceRequest;
 | 
					 | 
				
			||||||
use App\Jobs\Entity\EmailEntity;
 | 
					use App\Jobs\Entity\EmailEntity;
 | 
				
			||||||
use App\Jobs\Invoice\EmailCredit;
 | 
					use App\Jobs\Invoice\EmailCredit;
 | 
				
			||||||
use App\Jobs\Invoice\MarkInvoicePaid;
 | 
					 | 
				
			||||||
use App\Models\Client;
 | 
					use App\Models\Client;
 | 
				
			||||||
use App\Models\Credit;
 | 
					use App\Models\Credit;
 | 
				
			||||||
use App\Models\Invoice;
 | 
					use App\Models\Invoice;
 | 
				
			||||||
@ -187,7 +184,7 @@ class CreditController extends BaseController
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
        $credit = $this->credit_repository->save($request->all(), CreditFactory::create(auth()->user()->company()->id, auth()->user()->id));
 | 
					        $credit = $this->credit_repository->save($request->all(), CreditFactory::create(auth()->user()->company()->id, auth()->user()->id));
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        $credit = $credit->service()        
 | 
					        $credit = $credit->service()
 | 
				
			||||||
                         ->fillDefaults()
 | 
					                         ->fillDefaults()
 | 
				
			||||||
                         ->save();
 | 
					                         ->save();
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
				
			|||||||
@ -19,15 +19,12 @@ use App\Http\Requests\Design\EditDesignRequest;
 | 
				
			|||||||
use App\Http\Requests\Design\ShowDesignRequest;
 | 
					use App\Http\Requests\Design\ShowDesignRequest;
 | 
				
			||||||
use App\Http\Requests\Design\StoreDesignRequest;
 | 
					use App\Http\Requests\Design\StoreDesignRequest;
 | 
				
			||||||
use App\Http\Requests\Design\UpdateDesignRequest;
 | 
					use App\Http\Requests\Design\UpdateDesignRequest;
 | 
				
			||||||
use App\Jobs\Entity\ActionEntity;
 | 
					 | 
				
			||||||
use App\Models\Design;
 | 
					use App\Models\Design;
 | 
				
			||||||
use App\Repositories\DesignRepository;
 | 
					use App\Repositories\DesignRepository;
 | 
				
			||||||
use App\Transformers\DesignTransformer;
 | 
					use App\Transformers\DesignTransformer;
 | 
				
			||||||
use App\Utils\Traits\BulkOptions;
 | 
					 | 
				
			||||||
use App\Utils\Traits\MakesHash;
 | 
					use App\Utils\Traits\MakesHash;
 | 
				
			||||||
use Illuminate\Http\Request;
 | 
					use Illuminate\Http\Request;
 | 
				
			||||||
use Illuminate\Http\Response;
 | 
					use Illuminate\Http\Response;
 | 
				
			||||||
use Illuminate\Support\Facades\Cache;
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
/**
 | 
					/**
 | 
				
			||||||
 * Class DesignController.
 | 
					 * Class DesignController.
 | 
				
			||||||
 | 
				
			|||||||
@ -3,7 +3,6 @@
 | 
				
			|||||||
namespace App\Http\Controllers;
 | 
					namespace App\Http\Controllers;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
use App\Http\Requests\Document\DestroyDocumentRequest;
 | 
					use App\Http\Requests\Document\DestroyDocumentRequest;
 | 
				
			||||||
use App\Http\Requests\Document\EditDocumentRequest;
 | 
					 | 
				
			||||||
use App\Http\Requests\Document\ShowDocumentRequest;
 | 
					use App\Http\Requests\Document\ShowDocumentRequest;
 | 
				
			||||||
use App\Http\Requests\Document\StoreDocumentRequest;
 | 
					use App\Http\Requests\Document\StoreDocumentRequest;
 | 
				
			||||||
use App\Http\Requests\Document\UpdateDocumentRequest;
 | 
					use App\Http\Requests\Document\UpdateDocumentRequest;
 | 
				
			||||||
 | 
				
			|||||||
@ -13,13 +13,11 @@ namespace App\Http\Controllers;
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
use App\Http\Requests\Email\SendEmailRequest;
 | 
					use App\Http\Requests\Email\SendEmailRequest;
 | 
				
			||||||
use App\Jobs\Entity\EmailEntity;
 | 
					use App\Jobs\Entity\EmailEntity;
 | 
				
			||||||
use App\Jobs\Invoice\EmailInvoice;
 | 
					 | 
				
			||||||
use App\Jobs\Mail\EntitySentMailer;
 | 
					use App\Jobs\Mail\EntitySentMailer;
 | 
				
			||||||
use App\Models\Credit;
 | 
					use App\Models\Credit;
 | 
				
			||||||
use App\Models\Invoice;
 | 
					use App\Models\Invoice;
 | 
				
			||||||
use App\Models\Quote;
 | 
					use App\Models\Quote;
 | 
				
			||||||
use App\Models\RecurringInvoice;
 | 
					use App\Models\RecurringInvoice;
 | 
				
			||||||
use App\Notifications\SendGenericNotification;
 | 
					 | 
				
			||||||
use App\Transformers\CreditTransformer;
 | 
					use App\Transformers\CreditTransformer;
 | 
				
			||||||
use App\Transformers\InvoiceTransformer;
 | 
					use App\Transformers\InvoiceTransformer;
 | 
				
			||||||
use App\Transformers\QuoteTransformer;
 | 
					use App\Transformers\QuoteTransformer;
 | 
				
			||||||
@ -120,18 +118,14 @@ class EmailController extends BaseController
 | 
				
			|||||||
        $template = str_replace("email_template_", "", $template);
 | 
					        $template = str_replace("email_template_", "", $template);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        $entity_obj->invitations->each(function ($invitation) use ($subject, $body, $entity_string, $entity_obj, $template) {
 | 
					        $entity_obj->invitations->each(function ($invitation) use ($subject, $body, $entity_string, $entity_obj, $template) {
 | 
				
			||||||
 | 
					 | 
				
			||||||
            if ($invitation->contact->send_email && $invitation->contact->email) {
 | 
					            if ($invitation->contact->send_email && $invitation->contact->email) {
 | 
				
			||||||
 | 
					 | 
				
			||||||
                $data = [
 | 
					                $data = [
 | 
				
			||||||
                    'subject' => $subject,
 | 
					                    'subject' => $subject,
 | 
				
			||||||
                    'body' => $body
 | 
					                    'body' => $body
 | 
				
			||||||
                ];
 | 
					                ];
 | 
				
			||||||
                
 | 
					                
 | 
				
			||||||
                EmailEntity::dispatchNow($invitation, $invitation->company, $template, $data);
 | 
					                EmailEntity::dispatchNow($invitation, $invitation->company, $template, $data);
 | 
				
			||||||
 | 
					 | 
				
			||||||
            }
 | 
					            }
 | 
				
			||||||
 | 
					 | 
				
			||||||
        });
 | 
					        });
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        $entity_obj->last_sent_date = now();
 | 
					        $entity_obj->last_sent_date = now();
 | 
				
			||||||
 | 
				
			|||||||
@ -21,14 +21,7 @@ use App\Http\Requests\Expense\EditExpenseRequest;
 | 
				
			|||||||
use App\Http\Requests\Expense\ShowExpenseRequest;
 | 
					use App\Http\Requests\Expense\ShowExpenseRequest;
 | 
				
			||||||
use App\Http\Requests\Expense\StoreExpenseRequest;
 | 
					use App\Http\Requests\Expense\StoreExpenseRequest;
 | 
				
			||||||
use App\Http\Requests\Expense\UpdateExpenseRequest;
 | 
					use App\Http\Requests\Expense\UpdateExpenseRequest;
 | 
				
			||||||
use App\Jobs\Entity\ActionEntity;
 | 
					 | 
				
			||||||
use App\Jobs\Util\ProcessBulk;
 | 
					 | 
				
			||||||
use App\Jobs\Util\UploadAvatar;
 | 
					 | 
				
			||||||
use App\Models\Country;
 | 
					 | 
				
			||||||
use App\Models\Currency;
 | 
					 | 
				
			||||||
use App\Models\Expense;
 | 
					use App\Models\Expense;
 | 
				
			||||||
use App\Models\Size;
 | 
					 | 
				
			||||||
use App\Repositories\BaseRepository;
 | 
					 | 
				
			||||||
use App\Repositories\ExpenseRepository;
 | 
					use App\Repositories\ExpenseRepository;
 | 
				
			||||||
use App\Transformers\ExpenseTransformer;
 | 
					use App\Transformers\ExpenseTransformer;
 | 
				
			||||||
use App\Utils\Ninja;
 | 
					use App\Utils\Ninja;
 | 
				
			||||||
@ -37,8 +30,6 @@ use App\Utils\Traits\MakesHash;
 | 
				
			|||||||
use App\Utils\Traits\Uploadable;
 | 
					use App\Utils\Traits\Uploadable;
 | 
				
			||||||
use Illuminate\Http\Request;
 | 
					use Illuminate\Http\Request;
 | 
				
			||||||
use Illuminate\Http\Response;
 | 
					use Illuminate\Http\Response;
 | 
				
			||||||
use Illuminate\Support\Facades\Cache;
 | 
					 | 
				
			||||||
use Illuminate\Support\Facades\Log;
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
/**
 | 
					/**
 | 
				
			||||||
 * Class ExpenseController.
 | 
					 * Class ExpenseController.
 | 
				
			||||||
 | 
				
			|||||||
@ -18,7 +18,6 @@ use App\Http\Requests\GroupSetting\EditGroupSettingRequest;
 | 
				
			|||||||
use App\Http\Requests\GroupSetting\ShowGroupSettingRequest;
 | 
					use App\Http\Requests\GroupSetting\ShowGroupSettingRequest;
 | 
				
			||||||
use App\Http\Requests\GroupSetting\StoreGroupSettingRequest;
 | 
					use App\Http\Requests\GroupSetting\StoreGroupSettingRequest;
 | 
				
			||||||
use App\Http\Requests\GroupSetting\UpdateGroupSettingRequest;
 | 
					use App\Http\Requests\GroupSetting\UpdateGroupSettingRequest;
 | 
				
			||||||
use App\Http\Requests\SignupRequest;
 | 
					 | 
				
			||||||
use App\Models\GroupSetting;
 | 
					use App\Models\GroupSetting;
 | 
				
			||||||
use App\Repositories\GroupSettingRepository;
 | 
					use App\Repositories\GroupSettingRepository;
 | 
				
			||||||
use App\Transformers\GroupSettingTransformer;
 | 
					use App\Transformers\GroupSettingTransformer;
 | 
				
			||||||
 | 
				
			|||||||
@ -12,9 +12,7 @@
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
namespace App\Http\Controllers;
 | 
					namespace App\Http\Controllers;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
use App\DataMapper\CompanySettings;
 | 
					 | 
				
			||||||
use App\Events\Invoice\InvoiceWasCreated;
 | 
					use App\Events\Invoice\InvoiceWasCreated;
 | 
				
			||||||
use App\Events\Invoice\InvoiceWasEmailed;
 | 
					 | 
				
			||||||
use App\Events\Invoice\InvoiceWasUpdated;
 | 
					use App\Events\Invoice\InvoiceWasUpdated;
 | 
				
			||||||
use App\Factory\CloneInvoiceFactory;
 | 
					use App\Factory\CloneInvoiceFactory;
 | 
				
			||||||
use App\Factory\CloneInvoiceToQuoteFactory;
 | 
					use App\Factory\CloneInvoiceToQuoteFactory;
 | 
				
			||||||
@ -33,7 +31,6 @@ use App\Jobs\Invoice\ZipInvoices;
 | 
				
			|||||||
use App\Jobs\Util\UnlinkFile;
 | 
					use App\Jobs\Util\UnlinkFile;
 | 
				
			||||||
use App\Models\Client;
 | 
					use App\Models\Client;
 | 
				
			||||||
use App\Models\Invoice;
 | 
					use App\Models\Invoice;
 | 
				
			||||||
use App\Models\InvoiceInvitation;
 | 
					 | 
				
			||||||
use App\Models\Quote;
 | 
					use App\Models\Quote;
 | 
				
			||||||
use App\Repositories\InvoiceRepository;
 | 
					use App\Repositories\InvoiceRepository;
 | 
				
			||||||
use App\Transformers\InvoiceTransformer;
 | 
					use App\Transformers\InvoiceTransformer;
 | 
				
			||||||
@ -396,7 +393,7 @@ class InvoiceController extends BaseController
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
        $invoice = $this->invoice_repo->save($request->all(), $invoice);
 | 
					        $invoice = $this->invoice_repo->save($request->all(), $invoice);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        UnlinkFile::dispatchNow(config('filesystems.default'),$invoice->client->invoice_filepath().$invoice->number.'.pdf');
 | 
					        UnlinkFile::dispatchNow(config('filesystems.default'), $invoice->client->invoice_filepath().$invoice->number.'.pdf');
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        event(new InvoiceWasUpdated($invoice, $invoice->company, Ninja::eventVars()));
 | 
					        event(new InvoiceWasUpdated($invoice, $invoice->company, Ninja::eventVars()));
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@ -731,7 +728,6 @@ class InvoiceController extends BaseController
 | 
				
			|||||||
                $invoice->invitations->load('contact.client.country', 'invoice.client.country', 'invoice.company')->each(function ($invitation) use ($invoice) {
 | 
					                $invoice->invitations->load('contact.client.country', 'invoice.client.country', 'invoice.company')->each(function ($invitation) use ($invoice) {
 | 
				
			||||||
                    info("firing email");
 | 
					                    info("firing email");
 | 
				
			||||||
                    EmailEntity::dispatch($invitation, $invoice->company, $this->reminder_template);
 | 
					                    EmailEntity::dispatch($invitation, $invoice->company, $this->reminder_template);
 | 
				
			||||||
                    
 | 
					 | 
				
			||||||
                });
 | 
					                });
 | 
				
			||||||
 | 
					
 | 
				
			||||||
                if (! $bulk) {
 | 
					                if (! $bulk) {
 | 
				
			||||||
 | 
				
			|||||||
@ -13,8 +13,6 @@ namespace App\Http\Controllers;
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
use App\Models\Account;
 | 
					use App\Models\Account;
 | 
				
			||||||
use App\Utils\CurlUtils;
 | 
					use App\Utils\CurlUtils;
 | 
				
			||||||
use App\Utils\Ninja;
 | 
					 | 
				
			||||||
use Illuminate\Foundation\Bus\DispatchesJobs;
 | 
					 | 
				
			||||||
use Illuminate\Http\Request;
 | 
					use Illuminate\Http\Request;
 | 
				
			||||||
use Illuminate\Http\Response;
 | 
					use Illuminate\Http\Response;
 | 
				
			||||||
use stdClass;
 | 
					use stdClass;
 | 
				
			||||||
 | 
				
			|||||||
@ -21,7 +21,6 @@ use App\Models\Company;
 | 
				
			|||||||
use App\Models\CompanyToken;
 | 
					use App\Models\CompanyToken;
 | 
				
			||||||
use Illuminate\Foundation\Bus\DispatchesJobs;
 | 
					use Illuminate\Foundation\Bus\DispatchesJobs;
 | 
				
			||||||
use Illuminate\Http\Request;
 | 
					use Illuminate\Http\Request;
 | 
				
			||||||
use Illuminate\Support\Facades\Mail;
 | 
					 | 
				
			||||||
use Illuminate\Support\Str;
 | 
					use Illuminate\Support\Str;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
class MigrationController extends BaseController
 | 
					class MigrationController extends BaseController
 | 
				
			||||||
@ -219,7 +218,6 @@ class MigrationController extends BaseController
 | 
				
			|||||||
     */
 | 
					     */
 | 
				
			||||||
    public function startMigration(Request $request)
 | 
					    public function startMigration(Request $request)
 | 
				
			||||||
    {
 | 
					    {
 | 
				
			||||||
 | 
					 | 
				
			||||||
        $companies = json_decode($request->companies);
 | 
					        $companies = json_decode($request->companies);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        if (app()->environment() === 'local') {
 | 
					        if (app()->environment() === 'local') {
 | 
				
			||||||
@ -227,7 +225,6 @@ class MigrationController extends BaseController
 | 
				
			|||||||
        }
 | 
					        }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        foreach ($companies as $company) {
 | 
					        foreach ($companies as $company) {
 | 
				
			||||||
 | 
					 | 
				
			||||||
            $is_valid = $request->file($company->company_index)->isValid();
 | 
					            $is_valid = $request->file($company->company_index)->isValid();
 | 
				
			||||||
 | 
					
 | 
				
			||||||
            if (!$is_valid) {
 | 
					            if (!$is_valid) {
 | 
				
			||||||
 | 
				
			|||||||
@ -27,4 +27,4 @@
 | 
				
			|||||||
 *       @OA\Property(property="updated_at", type="number", format="integer", example="1434342123", description="Timestamp"),
 | 
					 *       @OA\Property(property="updated_at", type="number", format="integer", example="1434342123", description="Timestamp"),
 | 
				
			||||||
 *       @OA\Property(property="archived_at", type="number", format="integer", example="1434342123", description="Timestamp"),
 | 
					 *       @OA\Property(property="archived_at", type="number", format="integer", example="1434342123", description="Timestamp"),
 | 
				
			||||||
 * )
 | 
					 * )
 | 
				
			||||||
 */
 | 
					 */
 | 
				
			||||||
 | 
				
			|||||||
@ -11,6 +11,7 @@
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
namespace App\Http\Controllers;
 | 
					namespace App\Http\Controllers;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					use App\Events\Payment\PaymentWasUpdated;
 | 
				
			||||||
use App\Factory\PaymentFactory;
 | 
					use App\Factory\PaymentFactory;
 | 
				
			||||||
use App\Filters\PaymentFilters;
 | 
					use App\Filters\PaymentFilters;
 | 
				
			||||||
use App\Http\Requests\Payment\ActionPaymentRequest;
 | 
					use App\Http\Requests\Payment\ActionPaymentRequest;
 | 
				
			||||||
@ -21,18 +22,14 @@ use App\Http\Requests\Payment\RefundPaymentRequest;
 | 
				
			|||||||
use App\Http\Requests\Payment\ShowPaymentRequest;
 | 
					use App\Http\Requests\Payment\ShowPaymentRequest;
 | 
				
			||||||
use App\Http\Requests\Payment\StorePaymentRequest;
 | 
					use App\Http\Requests\Payment\StorePaymentRequest;
 | 
				
			||||||
use App\Http\Requests\Payment\UpdatePaymentRequest;
 | 
					use App\Http\Requests\Payment\UpdatePaymentRequest;
 | 
				
			||||||
use App\Jobs\Entity\ActionEntity;
 | 
					 | 
				
			||||||
use App\Jobs\Invoice\ReverseInvoicePayment;
 | 
					 | 
				
			||||||
use App\Models\Invoice;
 | 
					use App\Models\Invoice;
 | 
				
			||||||
use App\Models\Payment;
 | 
					use App\Models\Payment;
 | 
				
			||||||
use App\Repositories\BaseRepository;
 | 
					 | 
				
			||||||
use App\Repositories\PaymentRepository;
 | 
					use App\Repositories\PaymentRepository;
 | 
				
			||||||
use App\Transformers\PaymentTransformer;
 | 
					use App\Transformers\PaymentTransformer;
 | 
				
			||||||
 | 
					use App\Utils\Ninja;
 | 
				
			||||||
use App\Utils\Traits\MakesHash;
 | 
					use App\Utils\Traits\MakesHash;
 | 
				
			||||||
use App\Events\Payment\PaymentWasUpdated;
 | 
					 | 
				
			||||||
use Illuminate\Http\Request;
 | 
					use Illuminate\Http\Request;
 | 
				
			||||||
use Illuminate\Http\Response;
 | 
					use Illuminate\Http\Response;
 | 
				
			||||||
use App\Utils\Ninja;
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
/**
 | 
					/**
 | 
				
			||||||
 * Class PaymentController.
 | 
					 * Class PaymentController.
 | 
				
			||||||
 | 
				
			|||||||
Some files were not shown because too many files have changed in this diff Show More
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user