mirror of
				https://github.com/invoiceninja/invoiceninja.git
				synced 2025-11-04 01:57:31 -05:00 
			
		
		
		
	Merge pull request #8509 from turbo124/v5-develop
Fixes for chart queries
This commit is contained in:
		
						commit
						f5834cd854
					
				@ -63,7 +63,7 @@ class ChartController extends BaseController
 | 
			
		||||
     *           @OA\JsonContent(ref="#/components/schemas/Error"),
 | 
			
		||||
     *       ),
 | 
			
		||||
     *     )
 | 
			
		||||
     * @param Request $request
 | 
			
		||||
     * @param ShowChartRequest $request
 | 
			
		||||
     */
 | 
			
		||||
    public function totals(ShowChartRequest $request)
 | 
			
		||||
    {
 | 
			
		||||
 | 
			
		||||
@ -533,6 +533,8 @@ class Invoice extends BaseModel
 | 
			
		||||
 
 | 
			
		||||
    /**
 | 
			
		||||
     * Service entry points.
 | 
			
		||||
     *
 | 
			
		||||
     * @return InvoiceService
 | 
			
		||||
     */
 | 
			
		||||
    public function service() :InvoiceService
 | 
			
		||||
    {
 | 
			
		||||
 | 
			
		||||
@ -720,6 +720,27 @@ class BaseDriver extends AbstractPaymentDriver
 | 
			
		||||
        return $types;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    public function getStatementDescriptor(): string
 | 
			
		||||
    {
 | 
			
		||||
        App::forgetInstance('translator');
 | 
			
		||||
        $t = app('translator');
 | 
			
		||||
        $t->replace(Ninja::transformTranslations($this->client->getMergedSettings()));
 | 
			
		||||
        App::setLocale($this->client->company->locale());
 | 
			
		||||
        
 | 
			
		||||
        if (! $this->payment_hash || !$this->client) 
 | 
			
		||||
            return 'x';
 | 
			
		||||
 | 
			
		||||
        $invoices_string = \implode(', ', collect($this->payment_hash->invoices())->pluck('invoice_number')->toArray()) ?: null;
 | 
			
		||||
 | 
			
		||||
        $invoices_string = str_replace(["*","<",">","'",'"'], "-", $invoices_string);
 | 
			
		||||
        
 | 
			
		||||
        $invoices_string = substr($invoices_string,0,22);
 | 
			
		||||
        
 | 
			
		||||
        $invoices_string = str_pad($invoices_string, 5, ctrans('texts.invoice'), STR_PAD_LEFT);
 | 
			
		||||
 | 
			
		||||
        return $invoices_string;
 | 
			
		||||
 | 
			
		||||
    }
 | 
			
		||||
    /**
 | 
			
		||||
     * Generic description handler
 | 
			
		||||
     */
 | 
			
		||||
@ -735,7 +756,7 @@ class BaseDriver extends AbstractPaymentDriver
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        $invoices_string = \implode(', ', collect($this->payment_hash->invoices())->pluck('invoice_number')->toArray()) ?: null;
 | 
			
		||||
        $amount = Number::formatMoney($this->payment_hash?->amount_with_fee() ?: 0, $this->client);
 | 
			
		||||
        $amount = Number::formatMoney($this->payment_hash?->amount_with_fee() ?? 0, $this->client);
 | 
			
		||||
 | 
			
		||||
        if($abbreviated && $invoices_string){
 | 
			
		||||
            return $invoices_string;
 | 
			
		||||
 | 
			
		||||
@ -201,6 +201,7 @@ class ACH
 | 
			
		||||
                    'payment_hash' => $this->stripe->payment_hash->hash,
 | 
			
		||||
                    'gateway_type_id' => GatewayType::BANK_TRANSFER,
 | 
			
		||||
                ],
 | 
			
		||||
                'statement_descriptor' => $this->stripe->getStatementDescriptor(),
 | 
			
		||||
            ]
 | 
			
		||||
            );
 | 
			
		||||
        }
 | 
			
		||||
@ -275,6 +276,7 @@ class ACH
 | 
			
		||||
                    'payment_hash' => $this->stripe->payment_hash->hash,
 | 
			
		||||
                    'gateway_type_id' => $cgt->gateway_type_id,
 | 
			
		||||
                ],
 | 
			
		||||
                'statement_descriptor' => $this->stripe->getStatementDescriptor(),
 | 
			
		||||
            ];
 | 
			
		||||
 | 
			
		||||
            if ($cgt->gateway_type_id == GatewayType::BANK_TRANSFER) {
 | 
			
		||||
 | 
			
		||||
@ -85,10 +85,10 @@ trait ChartQueries
 | 
			
		||||
            payments.date,
 | 
			
		||||
            IFNULL(payments.currency_id, :company_currency) AS currency_id
 | 
			
		||||
            FROM payments
 | 
			
		||||
            WHERE payments.status_id IN (4,5,6)
 | 
			
		||||
            AND (payments.date BETWEEN :start_date AND :end_date)
 | 
			
		||||
            AND payments.company_id = :company_id
 | 
			
		||||
            WHERE payments.company_id = :company_id
 | 
			
		||||
            AND payments.is_deleted = 0
 | 
			
		||||
            AND payments.status_id IN (4,5,6)
 | 
			
		||||
            AND (payments.date BETWEEN :start_date AND :end_date)
 | 
			
		||||
            GROUP BY payments.date
 | 
			
		||||
            HAVING currency_id = :currency_id
 | 
			
		||||
        '), [
 | 
			
		||||
@ -108,15 +108,16 @@ trait ChartQueries
 | 
			
		||||
        return DB::select(DB::raw("
 | 
			
		||||
            SELECT
 | 
			
		||||
            sum(invoices.balance) as amount,
 | 
			
		||||
            IFNULL(JSON_EXTRACT( settings, '$.currency_id' ), :company_currency) AS currency_id
 | 
			
		||||
            COUNT(*) as outstanding_count, 
 | 
			
		||||
            IFNULL(CAST(JSON_UNQUOTE(JSON_EXTRACT( clients.settings, '$.currency_id' )) AS SIGNED), :company_currency) AS currency_id
 | 
			
		||||
            FROM clients
 | 
			
		||||
            JOIN invoices
 | 
			
		||||
            on invoices.client_id = clients.id
 | 
			
		||||
            WHERE invoices.status_id IN (2,3)
 | 
			
		||||
            AND invoices.company_id = :company_id
 | 
			
		||||
            AND invoices.balance > 0
 | 
			
		||||
            AND clients.is_deleted = 0
 | 
			
		||||
            AND invoices.is_deleted = 0
 | 
			
		||||
            AND invoices.balance > 0
 | 
			
		||||
            AND (invoices.date BETWEEN :start_date AND :end_date)
 | 
			
		||||
            GROUP BY currency_id
 | 
			
		||||
        "), ['company_currency' => $this->company->settings->currency_id, 'company_id' => $this->company->id, 'start_date' => $start_date, 'end_date' => $end_date]);
 | 
			
		||||
@ -127,11 +128,30 @@ trait ChartQueries
 | 
			
		||||
        return DB::select(DB::raw("
 | 
			
		||||
            SELECT
 | 
			
		||||
            sum(invoices.paid_to_date) as paid_to_date,
 | 
			
		||||
            IFNULL(JSON_EXTRACT( settings, '$.currency_id' ), :company_currency) AS currency_id
 | 
			
		||||
            IFNULL(CAST(JSON_UNQUOTE(JSON_EXTRACT( clients.settings, '$.currency_id' )) AS SIGNED), :company_currency) AS currency_id
 | 
			
		||||
            FROM clients
 | 
			
		||||
            JOIN invoices
 | 
			
		||||
            on invoices.client_id = clients.id
 | 
			
		||||
            WHERE invoices.status_id IN (3,4)
 | 
			
		||||
            WHERE invoices.company_id = :company_id
 | 
			
		||||
            AND clients.is_deleted = 0
 | 
			
		||||
            AND invoices.is_deleted = 0
 | 
			
		||||
            AND invoices.amount > 0
 | 
			
		||||
            AND invoices.status_id IN (3,4)
 | 
			
		||||
            AND (invoices.date BETWEEN :start_date AND :end_date)
 | 
			
		||||
            GROUP BY currency_id
 | 
			
		||||
        "), ['company_currency' => $this->company->settings->currency_id, 'company_id' => $this->company->id, 'start_date' => $start_date, 'end_date' => $end_date]);
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    public function getInvoicesQuery($start_date, $end_date)
 | 
			
		||||
    {
 | 
			
		||||
        return DB::select(DB::raw("
 | 
			
		||||
            SELECT
 | 
			
		||||
            sum(invoices.amount) as invoiced_amount,
 | 
			
		||||
            IFNULL(CAST(JSON_UNQUOTE(JSON_EXTRACT( clients.settings, '$.currency_id' )) AS SIGNED), :company_currency) AS currency_id
 | 
			
		||||
            FROM clients
 | 
			
		||||
            JOIN invoices
 | 
			
		||||
            on invoices.client_id = clients.id
 | 
			
		||||
            WHERE invoices.status_id IN (2,3,4)
 | 
			
		||||
            AND invoices.company_id = :company_id
 | 
			
		||||
            AND invoices.amount > 0
 | 
			
		||||
            AND clients.is_deleted = 0
 | 
			
		||||
@ -141,21 +161,48 @@ trait ChartQueries
 | 
			
		||||
        "), ['company_currency' => $this->company->settings->currency_id, 'company_id' => $this->company->id, 'start_date' => $start_date, 'end_date' => $end_date]);
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    public function getOutstandingChartQuery($start_date, $end_date, $currency_id)
 | 
			
		||||
    {
 | 
			
		||||
        return DB::select(DB::raw("
 | 
			
		||||
            SELECT
 | 
			
		||||
            sum(invoices.balance) as total,
 | 
			
		||||
            invoices.date,
 | 
			
		||||
            IFNULL(CAST(JSON_UNQUOTE(JSON_EXTRACT( clients.settings, '$.currency_id' )) AS SIGNED), :company_currency) AS currency_id
 | 
			
		||||
            FROM clients
 | 
			
		||||
            JOIN invoices
 | 
			
		||||
            on invoices.client_id = clients.id
 | 
			
		||||
            WHERE invoices.status_id IN (2,3,4)
 | 
			
		||||
            AND invoices.company_id = :company_id
 | 
			
		||||
            AND clients.is_deleted = 0
 | 
			
		||||
            AND invoices.is_deleted = 0
 | 
			
		||||
            AND (invoices.date BETWEEN :start_date AND :end_date)
 | 
			
		||||
            GROUP BY invoices.date
 | 
			
		||||
            HAVING currency_id = :currency_id
 | 
			
		||||
        "), [
 | 
			
		||||
            'company_currency' => (int) $this->company->settings->currency_id,
 | 
			
		||||
            'currency_id' => $currency_id,
 | 
			
		||||
            'company_id' => $this->company->id,
 | 
			
		||||
            'start_date' => $start_date,
 | 
			
		||||
            'end_date' => $end_date,
 | 
			
		||||
        ]);
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
    public function getInvoiceChartQuery($start_date, $end_date, $currency_id)
 | 
			
		||||
    {
 | 
			
		||||
        return DB::select(DB::raw("
 | 
			
		||||
            SELECT
 | 
			
		||||
            sum(invoices.amount) as total,
 | 
			
		||||
            invoices.date,
 | 
			
		||||
            IFNULL(CAST(JSON_EXTRACT( settings, '$.currency_id' ) AS SIGNED), :company_currency) AS currency_id
 | 
			
		||||
            IFNULL(CAST(JSON_UNQUOTE(JSON_EXTRACT( clients.settings, '$.currency_id' )) AS SIGNED), :company_currency) AS currency_id
 | 
			
		||||
            FROM clients
 | 
			
		||||
            JOIN invoices
 | 
			
		||||
            on invoices.client_id = clients.id
 | 
			
		||||
            WHERE invoices.status_id IN (2,3,4)
 | 
			
		||||
            AND (invoices.date BETWEEN :start_date AND :end_date)
 | 
			
		||||
            AND invoices.company_id = :company_id
 | 
			
		||||
            WHERE invoices.company_id = :company_id
 | 
			
		||||
            AND clients.is_deleted = 0
 | 
			
		||||
            AND invoices.is_deleted = 0
 | 
			
		||||
            AND invoices.status_id IN (2,3,4)
 | 
			
		||||
            AND (invoices.date BETWEEN :start_date AND :end_date)
 | 
			
		||||
            GROUP BY invoices.date
 | 
			
		||||
            HAVING currency_id = :currency_id
 | 
			
		||||
        "), [
 | 
			
		||||
 | 
			
		||||
@ -75,6 +75,7 @@ class ChartService
 | 
			
		||||
 | 
			
		||||
        foreach ($currencies as $key => $value) {
 | 
			
		||||
            $data[$key]['invoices'] = $this->getInvoiceChartQuery($start_date, $end_date, $key);
 | 
			
		||||
            $data[$key]['outstanding'] = $this->getOutstandingChartQuery($start_date, $end_date, $key);
 | 
			
		||||
            $data[$key]['payments'] = $this->getPaymentChartQuery($start_date, $end_date, $key);
 | 
			
		||||
            $data[$key]['expenses'] = $this->getExpenseChartQuery($start_date, $end_date, $key);
 | 
			
		||||
        }
 | 
			
		||||
@ -92,19 +93,36 @@ class ChartService
 | 
			
		||||
 | 
			
		||||
        $data['currencies'] = $this->getCurrencyCodes();
 | 
			
		||||
 | 
			
		||||
        foreach ($data['currencies'] as $key => $value) {
 | 
			
		||||
        $revenue = $this->getRevenue($start_date, $end_date);
 | 
			
		||||
        $outstanding = $this->getOutstanding($start_date, $end_date);
 | 
			
		||||
        $expenses = $this->getExpenses($start_date, $end_date);
 | 
			
		||||
        $invoices = $this->getInvoices($start_date, $end_date);
 | 
			
		||||
 | 
			
		||||
        foreach ($data['currencies'] as $key => $value) {
 | 
			
		||||
           
 | 
			
		||||
            $invoices_set = array_search($key, array_column($invoices, 'currency_id'));
 | 
			
		||||
            $revenue_set = array_search($key, array_column($revenue, 'currency_id'));
 | 
			
		||||
            $outstanding_set = array_search($key, array_column($outstanding, 'currency_id'));
 | 
			
		||||
            $expenses_set = array_search($key, array_column($expenses, 'currency_id'));
 | 
			
		||||
 | 
			
		||||
            $data[$key]['invoices'] = $invoices_set !== false ? $invoices[array_search($key, array_column($invoices, 'currency_id'))] : new \stdClass;
 | 
			
		||||
            $data[$key]['revenue'] = $revenue_set !== false ? $revenue[array_search($key, array_column($revenue, 'currency_id'))] : new \stdClass;
 | 
			
		||||
            $data[$key]['outstanding'] = $outstanding_set !== false ? $outstanding[array_search($key, array_column($outstanding, 'currency_id'))] : new \stdClass;
 | 
			
		||||
            $data[$key]['expenses'] = $expenses_set !== false ? $expenses[array_search($key, array_column($expenses, 'currency_id'))] : new \stdClass;
 | 
			
		||||
 | 
			
		||||
            $data[$key]['revenue'] = count($revenue) > 0 ? $revenue[array_search($key, array_column($revenue, 'currency_id'))] : new \stdClass;
 | 
			
		||||
            $data[$key]['outstanding'] = count($outstanding) > 0 ? $outstanding[array_search($key, array_column($outstanding, 'currency_id'))] : new \stdClass;
 | 
			
		||||
            $data[$key]['expenses'] = count($expenses) > 0 ? $expenses[array_search($key, array_column($expenses, 'currency_id'))] : new \stdClass;
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        return $data;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    public function getInvoices($start_date, $end_date) :array
 | 
			
		||||
    {
 | 
			
		||||
        $revenue = $this->getInvoicesQuery($start_date, $end_date);
 | 
			
		||||
        $revenue = $this->addCurrencyCodes($revenue);
 | 
			
		||||
 | 
			
		||||
        return $revenue;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    public function getRevenue($start_date, $end_date) :array
 | 
			
		||||
    {
 | 
			
		||||
        $revenue = $this->getRevenueQuery($start_date, $end_date);
 | 
			
		||||
 | 
			
		||||
@ -49,7 +49,14 @@ class InvoiceService
 | 
			
		||||
        return $this;
 | 
			
		||||
    }
 | 
			
		||||
    
 | 
			
		||||
    public function applyPaymentAmount($amount, ?string $reference = null)
 | 
			
		||||
    /**
 | 
			
		||||
     * applyPaymentAmount
 | 
			
		||||
     *
 | 
			
		||||
     * @param  float $amount
 | 
			
		||||
     * @param  ?string $reference
 | 
			
		||||
     * @return self
 | 
			
		||||
     */
 | 
			
		||||
    public function applyPaymentAmount($amount, ?string $reference = null): self
 | 
			
		||||
    {
 | 
			
		||||
        $this->invoice = (new ApplyPaymentAmount($this->invoice, $amount, $reference))->run();
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
@ -237,7 +237,7 @@ class ProfitLoss
 | 
			
		||||
            sum(invoices.total_taxes) as total_taxes,
 | 
			
		||||
            (sum(invoices.total_taxes) / IFNULL(invoices.exchange_rate, 1)) AS net_converted_taxes,
 | 
			
		||||
            sum(invoices.amount - invoices.total_taxes) as net_amount,
 | 
			
		||||
            IFNULL(JSON_EXTRACT( settings, '$.currency_id' ), :company_currency) AS currency_id,
 | 
			
		||||
            IFNULL(CAST(JSON_UNQUOTE(JSON_EXTRACT( clients.settings, '$.currency_id' )) AS SIGNED), :company_currency) AS currency_id,
 | 
			
		||||
            (sum(invoices.amount - invoices.total_taxes) / IFNULL(invoices.exchange_rate, 1)) AS net_converted_amount
 | 
			
		||||
            FROM clients
 | 
			
		||||
            JOIN invoices
 | 
			
		||||
 | 
			
		||||
@ -84,6 +84,7 @@
 | 
			
		||||
        "shopify/shopify-api": "^4.3",
 | 
			
		||||
        "socialiteproviders/apple": "^5.2",
 | 
			
		||||
        "socialiteproviders/microsoft": "^4.1",
 | 
			
		||||
        "spatie/laravel-data": "^3.5",
 | 
			
		||||
        "sprain/swiss-qr-bill": "^3.2",
 | 
			
		||||
        "square/square": "13.0.0.20210721",
 | 
			
		||||
        "stripe/stripe-php": "^7.50",
 | 
			
		||||
 | 
			
		||||
							
								
								
									
										367
									
								
								composer.lock
									
									
									
										generated
									
									
									
								
							
							
						
						
									
										367
									
								
								composer.lock
									
									
									
										generated
									
									
									
								
							@ -4,7 +4,7 @@
 | 
			
		||||
        "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies",
 | 
			
		||||
        "This file is @generated automatically"
 | 
			
		||||
    ],
 | 
			
		||||
    "content-hash": "c5abc776f4fd59ba436de99f6c401429",
 | 
			
		||||
    "content-hash": "358ef9c0394067f5ea70855a928687cf",
 | 
			
		||||
    "packages": [
 | 
			
		||||
        {
 | 
			
		||||
            "name": "adrienrn/php-mimetyper",
 | 
			
		||||
@ -7594,6 +7594,117 @@
 | 
			
		||||
            },
 | 
			
		||||
            "time": "2020-07-07T09:29:14+00:00"
 | 
			
		||||
        },
 | 
			
		||||
        {
 | 
			
		||||
            "name": "phpdocumentor/reflection-common",
 | 
			
		||||
            "version": "2.2.0",
 | 
			
		||||
            "source": {
 | 
			
		||||
                "type": "git",
 | 
			
		||||
                "url": "https://github.com/phpDocumentor/ReflectionCommon.git",
 | 
			
		||||
                "reference": "1d01c49d4ed62f25aa84a747ad35d5a16924662b"
 | 
			
		||||
            },
 | 
			
		||||
            "dist": {
 | 
			
		||||
                "type": "zip",
 | 
			
		||||
                "url": "https://api.github.com/repos/phpDocumentor/ReflectionCommon/zipball/1d01c49d4ed62f25aa84a747ad35d5a16924662b",
 | 
			
		||||
                "reference": "1d01c49d4ed62f25aa84a747ad35d5a16924662b",
 | 
			
		||||
                "shasum": ""
 | 
			
		||||
            },
 | 
			
		||||
            "require": {
 | 
			
		||||
                "php": "^7.2 || ^8.0"
 | 
			
		||||
            },
 | 
			
		||||
            "type": "library",
 | 
			
		||||
            "extra": {
 | 
			
		||||
                "branch-alias": {
 | 
			
		||||
                    "dev-2.x": "2.x-dev"
 | 
			
		||||
                }
 | 
			
		||||
            },
 | 
			
		||||
            "autoload": {
 | 
			
		||||
                "psr-4": {
 | 
			
		||||
                    "phpDocumentor\\Reflection\\": "src/"
 | 
			
		||||
                }
 | 
			
		||||
            },
 | 
			
		||||
            "notification-url": "https://packagist.org/downloads/",
 | 
			
		||||
            "license": [
 | 
			
		||||
                "MIT"
 | 
			
		||||
            ],
 | 
			
		||||
            "authors": [
 | 
			
		||||
                {
 | 
			
		||||
                    "name": "Jaap van Otterdijk",
 | 
			
		||||
                    "email": "opensource@ijaap.nl"
 | 
			
		||||
                }
 | 
			
		||||
            ],
 | 
			
		||||
            "description": "Common reflection classes used by phpdocumentor to reflect the code structure",
 | 
			
		||||
            "homepage": "http://www.phpdoc.org",
 | 
			
		||||
            "keywords": [
 | 
			
		||||
                "FQSEN",
 | 
			
		||||
                "phpDocumentor",
 | 
			
		||||
                "phpdoc",
 | 
			
		||||
                "reflection",
 | 
			
		||||
                "static analysis"
 | 
			
		||||
            ],
 | 
			
		||||
            "support": {
 | 
			
		||||
                "issues": "https://github.com/phpDocumentor/ReflectionCommon/issues",
 | 
			
		||||
                "source": "https://github.com/phpDocumentor/ReflectionCommon/tree/2.x"
 | 
			
		||||
            },
 | 
			
		||||
            "time": "2020-06-27T09:03:43+00:00"
 | 
			
		||||
        },
 | 
			
		||||
        {
 | 
			
		||||
            "name": "phpdocumentor/type-resolver",
 | 
			
		||||
            "version": "1.7.1",
 | 
			
		||||
            "source": {
 | 
			
		||||
                "type": "git",
 | 
			
		||||
                "url": "https://github.com/phpDocumentor/TypeResolver.git",
 | 
			
		||||
                "reference": "dfc078e8af9c99210337325ff5aa152872c98714"
 | 
			
		||||
            },
 | 
			
		||||
            "dist": {
 | 
			
		||||
                "type": "zip",
 | 
			
		||||
                "url": "https://api.github.com/repos/phpDocumentor/TypeResolver/zipball/dfc078e8af9c99210337325ff5aa152872c98714",
 | 
			
		||||
                "reference": "dfc078e8af9c99210337325ff5aa152872c98714",
 | 
			
		||||
                "shasum": ""
 | 
			
		||||
            },
 | 
			
		||||
            "require": {
 | 
			
		||||
                "doctrine/deprecations": "^1.0",
 | 
			
		||||
                "php": "^7.4 || ^8.0",
 | 
			
		||||
                "phpdocumentor/reflection-common": "^2.0",
 | 
			
		||||
                "phpstan/phpdoc-parser": "^1.13"
 | 
			
		||||
            },
 | 
			
		||||
            "require-dev": {
 | 
			
		||||
                "ext-tokenizer": "*",
 | 
			
		||||
                "phpbench/phpbench": "^1.2",
 | 
			
		||||
                "phpstan/extension-installer": "^1.1",
 | 
			
		||||
                "phpstan/phpstan": "^1.8",
 | 
			
		||||
                "phpstan/phpstan-phpunit": "^1.1",
 | 
			
		||||
                "phpunit/phpunit": "^9.5",
 | 
			
		||||
                "rector/rector": "^0.13.9",
 | 
			
		||||
                "vimeo/psalm": "^4.25"
 | 
			
		||||
            },
 | 
			
		||||
            "type": "library",
 | 
			
		||||
            "extra": {
 | 
			
		||||
                "branch-alias": {
 | 
			
		||||
                    "dev-1.x": "1.x-dev"
 | 
			
		||||
                }
 | 
			
		||||
            },
 | 
			
		||||
            "autoload": {
 | 
			
		||||
                "psr-4": {
 | 
			
		||||
                    "phpDocumentor\\Reflection\\": "src"
 | 
			
		||||
                }
 | 
			
		||||
            },
 | 
			
		||||
            "notification-url": "https://packagist.org/downloads/",
 | 
			
		||||
            "license": [
 | 
			
		||||
                "MIT"
 | 
			
		||||
            ],
 | 
			
		||||
            "authors": [
 | 
			
		||||
                {
 | 
			
		||||
                    "name": "Mike van Riel",
 | 
			
		||||
                    "email": "me@mikevanriel.com"
 | 
			
		||||
                }
 | 
			
		||||
            ],
 | 
			
		||||
            "description": "A PSR-5 based resolver of Class names, Types and Structural Element Names",
 | 
			
		||||
            "support": {
 | 
			
		||||
                "issues": "https://github.com/phpDocumentor/TypeResolver/issues",
 | 
			
		||||
                "source": "https://github.com/phpDocumentor/TypeResolver/tree/1.7.1"
 | 
			
		||||
            },
 | 
			
		||||
            "time": "2023-03-27T19:02:04+00:00"
 | 
			
		||||
        },
 | 
			
		||||
        {
 | 
			
		||||
            "name": "phpoption/phpoption",
 | 
			
		||||
            "version": "1.9.1",
 | 
			
		||||
@ -9654,6 +9765,149 @@
 | 
			
		||||
            },
 | 
			
		||||
            "time": "2023-03-02T09:58:36+00:00"
 | 
			
		||||
        },
 | 
			
		||||
        {
 | 
			
		||||
            "name": "spatie/laravel-data",
 | 
			
		||||
            "version": "3.5.0",
 | 
			
		||||
            "source": {
 | 
			
		||||
                "type": "git",
 | 
			
		||||
                "url": "https://github.com/spatie/laravel-data.git",
 | 
			
		||||
                "reference": "4c3c31d7d9a515125bfa219099c4df563e4422a8"
 | 
			
		||||
            },
 | 
			
		||||
            "dist": {
 | 
			
		||||
                "type": "zip",
 | 
			
		||||
                "url": "https://api.github.com/repos/spatie/laravel-data/zipball/4c3c31d7d9a515125bfa219099c4df563e4422a8",
 | 
			
		||||
                "reference": "4c3c31d7d9a515125bfa219099c4df563e4422a8",
 | 
			
		||||
                "shasum": ""
 | 
			
		||||
            },
 | 
			
		||||
            "require": {
 | 
			
		||||
                "illuminate/contracts": "^9.30|^10.0",
 | 
			
		||||
                "php": "^8.1",
 | 
			
		||||
                "phpdocumentor/type-resolver": "^1.5",
 | 
			
		||||
                "spatie/laravel-package-tools": "^1.9.0"
 | 
			
		||||
            },
 | 
			
		||||
            "require-dev": {
 | 
			
		||||
                "fakerphp/faker": "^1.14",
 | 
			
		||||
                "friendsofphp/php-cs-fixer": "^3.0",
 | 
			
		||||
                "inertiajs/inertia-laravel": "^0.6.3",
 | 
			
		||||
                "nesbot/carbon": "^2.63",
 | 
			
		||||
                "nette/php-generator": "^3.5",
 | 
			
		||||
                "nunomaduro/larastan": "^2.0",
 | 
			
		||||
                "orchestra/testbench": "^7.6|^8.0",
 | 
			
		||||
                "pestphp/pest": "^1.22",
 | 
			
		||||
                "pestphp/pest-plugin-laravel": "^1.3",
 | 
			
		||||
                "phpbench/phpbench": "^1.2",
 | 
			
		||||
                "phpstan/extension-installer": "^1.1",
 | 
			
		||||
                "phpunit/phpunit": "^9.3",
 | 
			
		||||
                "spatie/invade": "^1.0",
 | 
			
		||||
                "spatie/laravel-typescript-transformer": "^2.1.6",
 | 
			
		||||
                "spatie/pest-plugin-snapshots": "^1.1",
 | 
			
		||||
                "spatie/phpunit-snapshot-assertions": "^4.2",
 | 
			
		||||
                "spatie/test-time": "^1.2"
 | 
			
		||||
            },
 | 
			
		||||
            "type": "library",
 | 
			
		||||
            "extra": {
 | 
			
		||||
                "laravel": {
 | 
			
		||||
                    "providers": [
 | 
			
		||||
                        "Spatie\\LaravelData\\LaravelDataServiceProvider"
 | 
			
		||||
                    ]
 | 
			
		||||
                }
 | 
			
		||||
            },
 | 
			
		||||
            "autoload": {
 | 
			
		||||
                "psr-4": {
 | 
			
		||||
                    "Spatie\\LaravelData\\": "src",
 | 
			
		||||
                    "Spatie\\LaravelData\\Database\\Factories\\": "database/factories"
 | 
			
		||||
                }
 | 
			
		||||
            },
 | 
			
		||||
            "notification-url": "https://packagist.org/downloads/",
 | 
			
		||||
            "license": [
 | 
			
		||||
                "MIT"
 | 
			
		||||
            ],
 | 
			
		||||
            "authors": [
 | 
			
		||||
                {
 | 
			
		||||
                    "name": "Ruben Van Assche",
 | 
			
		||||
                    "email": "ruben@spatie.be",
 | 
			
		||||
                    "role": "Developer"
 | 
			
		||||
                }
 | 
			
		||||
            ],
 | 
			
		||||
            "description": "Create unified resources and data transfer objects",
 | 
			
		||||
            "homepage": "https://github.com/spatie/laravel-data",
 | 
			
		||||
            "keywords": [
 | 
			
		||||
                "laravel",
 | 
			
		||||
                "laravel-data",
 | 
			
		||||
                "spatie"
 | 
			
		||||
            ],
 | 
			
		||||
            "support": {
 | 
			
		||||
                "issues": "https://github.com/spatie/laravel-data/issues",
 | 
			
		||||
                "source": "https://github.com/spatie/laravel-data/tree/3.5.0"
 | 
			
		||||
            },
 | 
			
		||||
            "funding": [
 | 
			
		||||
                {
 | 
			
		||||
                    "url": "https://github.com/spatie",
 | 
			
		||||
                    "type": "github"
 | 
			
		||||
                }
 | 
			
		||||
            ],
 | 
			
		||||
            "time": "2023-05-05T15:24:41+00:00"
 | 
			
		||||
        },
 | 
			
		||||
        {
 | 
			
		||||
            "name": "spatie/laravel-package-tools",
 | 
			
		||||
            "version": "1.15.0",
 | 
			
		||||
            "source": {
 | 
			
		||||
                "type": "git",
 | 
			
		||||
                "url": "https://github.com/spatie/laravel-package-tools.git",
 | 
			
		||||
                "reference": "efab1844b8826443135201c4443690f032c3d533"
 | 
			
		||||
            },
 | 
			
		||||
            "dist": {
 | 
			
		||||
                "type": "zip",
 | 
			
		||||
                "url": "https://api.github.com/repos/spatie/laravel-package-tools/zipball/efab1844b8826443135201c4443690f032c3d533",
 | 
			
		||||
                "reference": "efab1844b8826443135201c4443690f032c3d533",
 | 
			
		||||
                "shasum": ""
 | 
			
		||||
            },
 | 
			
		||||
            "require": {
 | 
			
		||||
                "illuminate/contracts": "^9.28|^10.0",
 | 
			
		||||
                "php": "^8.0"
 | 
			
		||||
            },
 | 
			
		||||
            "require-dev": {
 | 
			
		||||
                "mockery/mockery": "^1.5",
 | 
			
		||||
                "orchestra/testbench": "^7.7|^8.0",
 | 
			
		||||
                "pestphp/pest": "^1.22",
 | 
			
		||||
                "phpunit/phpunit": "^9.5.24",
 | 
			
		||||
                "spatie/pest-plugin-test-time": "^1.1"
 | 
			
		||||
            },
 | 
			
		||||
            "type": "library",
 | 
			
		||||
            "autoload": {
 | 
			
		||||
                "psr-4": {
 | 
			
		||||
                    "Spatie\\LaravelPackageTools\\": "src"
 | 
			
		||||
                }
 | 
			
		||||
            },
 | 
			
		||||
            "notification-url": "https://packagist.org/downloads/",
 | 
			
		||||
            "license": [
 | 
			
		||||
                "MIT"
 | 
			
		||||
            ],
 | 
			
		||||
            "authors": [
 | 
			
		||||
                {
 | 
			
		||||
                    "name": "Freek Van der Herten",
 | 
			
		||||
                    "email": "freek@spatie.be",
 | 
			
		||||
                    "role": "Developer"
 | 
			
		||||
                }
 | 
			
		||||
            ],
 | 
			
		||||
            "description": "Tools for creating Laravel packages",
 | 
			
		||||
            "homepage": "https://github.com/spatie/laravel-package-tools",
 | 
			
		||||
            "keywords": [
 | 
			
		||||
                "laravel-package-tools",
 | 
			
		||||
                "spatie"
 | 
			
		||||
            ],
 | 
			
		||||
            "support": {
 | 
			
		||||
                "issues": "https://github.com/spatie/laravel-package-tools/issues",
 | 
			
		||||
                "source": "https://github.com/spatie/laravel-package-tools/tree/1.15.0"
 | 
			
		||||
            },
 | 
			
		||||
            "funding": [
 | 
			
		||||
                {
 | 
			
		||||
                    "url": "https://github.com/spatie",
 | 
			
		||||
                    "type": "github"
 | 
			
		||||
                }
 | 
			
		||||
            ],
 | 
			
		||||
            "time": "2023-04-27T08:09:01+00:00"
 | 
			
		||||
        },
 | 
			
		||||
        {
 | 
			
		||||
            "name": "sprain/swiss-qr-bill",
 | 
			
		||||
            "version": "v3.3",
 | 
			
		||||
@ -15834,59 +16088,6 @@
 | 
			
		||||
            },
 | 
			
		||||
            "time": "2023-02-09T12:12:19+00:00"
 | 
			
		||||
        },
 | 
			
		||||
        {
 | 
			
		||||
            "name": "phpdocumentor/reflection-common",
 | 
			
		||||
            "version": "2.2.0",
 | 
			
		||||
            "source": {
 | 
			
		||||
                "type": "git",
 | 
			
		||||
                "url": "https://github.com/phpDocumentor/ReflectionCommon.git",
 | 
			
		||||
                "reference": "1d01c49d4ed62f25aa84a747ad35d5a16924662b"
 | 
			
		||||
            },
 | 
			
		||||
            "dist": {
 | 
			
		||||
                "type": "zip",
 | 
			
		||||
                "url": "https://api.github.com/repos/phpDocumentor/ReflectionCommon/zipball/1d01c49d4ed62f25aa84a747ad35d5a16924662b",
 | 
			
		||||
                "reference": "1d01c49d4ed62f25aa84a747ad35d5a16924662b",
 | 
			
		||||
                "shasum": ""
 | 
			
		||||
            },
 | 
			
		||||
            "require": {
 | 
			
		||||
                "php": "^7.2 || ^8.0"
 | 
			
		||||
            },
 | 
			
		||||
            "type": "library",
 | 
			
		||||
            "extra": {
 | 
			
		||||
                "branch-alias": {
 | 
			
		||||
                    "dev-2.x": "2.x-dev"
 | 
			
		||||
                }
 | 
			
		||||
            },
 | 
			
		||||
            "autoload": {
 | 
			
		||||
                "psr-4": {
 | 
			
		||||
                    "phpDocumentor\\Reflection\\": "src/"
 | 
			
		||||
                }
 | 
			
		||||
            },
 | 
			
		||||
            "notification-url": "https://packagist.org/downloads/",
 | 
			
		||||
            "license": [
 | 
			
		||||
                "MIT"
 | 
			
		||||
            ],
 | 
			
		||||
            "authors": [
 | 
			
		||||
                {
 | 
			
		||||
                    "name": "Jaap van Otterdijk",
 | 
			
		||||
                    "email": "opensource@ijaap.nl"
 | 
			
		||||
                }
 | 
			
		||||
            ],
 | 
			
		||||
            "description": "Common reflection classes used by phpdocumentor to reflect the code structure",
 | 
			
		||||
            "homepage": "http://www.phpdoc.org",
 | 
			
		||||
            "keywords": [
 | 
			
		||||
                "FQSEN",
 | 
			
		||||
                "phpDocumentor",
 | 
			
		||||
                "phpdoc",
 | 
			
		||||
                "reflection",
 | 
			
		||||
                "static analysis"
 | 
			
		||||
            ],
 | 
			
		||||
            "support": {
 | 
			
		||||
                "issues": "https://github.com/phpDocumentor/ReflectionCommon/issues",
 | 
			
		||||
                "source": "https://github.com/phpDocumentor/ReflectionCommon/tree/2.x"
 | 
			
		||||
            },
 | 
			
		||||
            "time": "2020-06-27T09:03:43+00:00"
 | 
			
		||||
        },
 | 
			
		||||
        {
 | 
			
		||||
            "name": "phpdocumentor/reflection-docblock",
 | 
			
		||||
            "version": "5.3.0",
 | 
			
		||||
@ -15944,64 +16145,6 @@
 | 
			
		||||
            },
 | 
			
		||||
            "time": "2021-10-19T17:43:47+00:00"
 | 
			
		||||
        },
 | 
			
		||||
        {
 | 
			
		||||
            "name": "phpdocumentor/type-resolver",
 | 
			
		||||
            "version": "1.7.1",
 | 
			
		||||
            "source": {
 | 
			
		||||
                "type": "git",
 | 
			
		||||
                "url": "https://github.com/phpDocumentor/TypeResolver.git",
 | 
			
		||||
                "reference": "dfc078e8af9c99210337325ff5aa152872c98714"
 | 
			
		||||
            },
 | 
			
		||||
            "dist": {
 | 
			
		||||
                "type": "zip",
 | 
			
		||||
                "url": "https://api.github.com/repos/phpDocumentor/TypeResolver/zipball/dfc078e8af9c99210337325ff5aa152872c98714",
 | 
			
		||||
                "reference": "dfc078e8af9c99210337325ff5aa152872c98714",
 | 
			
		||||
                "shasum": ""
 | 
			
		||||
            },
 | 
			
		||||
            "require": {
 | 
			
		||||
                "doctrine/deprecations": "^1.0",
 | 
			
		||||
                "php": "^7.4 || ^8.0",
 | 
			
		||||
                "phpdocumentor/reflection-common": "^2.0",
 | 
			
		||||
                "phpstan/phpdoc-parser": "^1.13"
 | 
			
		||||
            },
 | 
			
		||||
            "require-dev": {
 | 
			
		||||
                "ext-tokenizer": "*",
 | 
			
		||||
                "phpbench/phpbench": "^1.2",
 | 
			
		||||
                "phpstan/extension-installer": "^1.1",
 | 
			
		||||
                "phpstan/phpstan": "^1.8",
 | 
			
		||||
                "phpstan/phpstan-phpunit": "^1.1",
 | 
			
		||||
                "phpunit/phpunit": "^9.5",
 | 
			
		||||
                "rector/rector": "^0.13.9",
 | 
			
		||||
                "vimeo/psalm": "^4.25"
 | 
			
		||||
            },
 | 
			
		||||
            "type": "library",
 | 
			
		||||
            "extra": {
 | 
			
		||||
                "branch-alias": {
 | 
			
		||||
                    "dev-1.x": "1.x-dev"
 | 
			
		||||
                }
 | 
			
		||||
            },
 | 
			
		||||
            "autoload": {
 | 
			
		||||
                "psr-4": {
 | 
			
		||||
                    "phpDocumentor\\Reflection\\": "src"
 | 
			
		||||
                }
 | 
			
		||||
            },
 | 
			
		||||
            "notification-url": "https://packagist.org/downloads/",
 | 
			
		||||
            "license": [
 | 
			
		||||
                "MIT"
 | 
			
		||||
            ],
 | 
			
		||||
            "authors": [
 | 
			
		||||
                {
 | 
			
		||||
                    "name": "Mike van Riel",
 | 
			
		||||
                    "email": "me@mikevanriel.com"
 | 
			
		||||
                }
 | 
			
		||||
            ],
 | 
			
		||||
            "description": "A PSR-5 based resolver of Class names, Types and Structural Element Names",
 | 
			
		||||
            "support": {
 | 
			
		||||
                "issues": "https://github.com/phpDocumentor/TypeResolver/issues",
 | 
			
		||||
                "source": "https://github.com/phpDocumentor/TypeResolver/tree/1.7.1"
 | 
			
		||||
            },
 | 
			
		||||
            "time": "2023-03-27T19:02:04+00:00"
 | 
			
		||||
        },
 | 
			
		||||
        {
 | 
			
		||||
            "name": "phpmyadmin/sql-parser",
 | 
			
		||||
            "version": "5.7.0",
 | 
			
		||||
 | 
			
		||||
							
								
								
									
										71
									
								
								config/data.php
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										71
									
								
								config/data.php
									
									
									
									
									
										Normal file
									
								
							@ -0,0 +1,71 @@
 | 
			
		||||
<?php
 | 
			
		||||
 | 
			
		||||
return [
 | 
			
		||||
    /*
 | 
			
		||||
     * The package will use this format when working with dates. If this option
 | 
			
		||||
     * is an array, it will try to convert from the first format that works,
 | 
			
		||||
     * and will serialize dates using the first format from the array.
 | 
			
		||||
     */
 | 
			
		||||
    'date_format' => DATE_ATOM,
 | 
			
		||||
 | 
			
		||||
    /*
 | 
			
		||||
     * Global transformers will take complex types and transform them into simple
 | 
			
		||||
     * types.
 | 
			
		||||
     */
 | 
			
		||||
    'transformers' => [
 | 
			
		||||
        DateTimeInterface::class => \Spatie\LaravelData\Transformers\DateTimeInterfaceTransformer::class,
 | 
			
		||||
        \Illuminate\Contracts\Support\Arrayable::class => \Spatie\LaravelData\Transformers\ArrayableTransformer::class,
 | 
			
		||||
        BackedEnum::class => Spatie\LaravelData\Transformers\EnumTransformer::class,
 | 
			
		||||
    ],
 | 
			
		||||
 | 
			
		||||
    /*
 | 
			
		||||
     * Global casts will cast values into complex types when creating a data
 | 
			
		||||
     * object from simple types.
 | 
			
		||||
     */
 | 
			
		||||
    'casts' => [
 | 
			
		||||
        DateTimeInterface::class => Spatie\LaravelData\Casts\DateTimeInterfaceCast::class,
 | 
			
		||||
        BackedEnum::class => Spatie\LaravelData\Casts\EnumCast::class,
 | 
			
		||||
    ],
 | 
			
		||||
 | 
			
		||||
    /*
 | 
			
		||||
     * Rule inferrers can be configured here. They will automatically add
 | 
			
		||||
     * validation rules to properties of a data object based upon
 | 
			
		||||
     * the type of the property.
 | 
			
		||||
     */
 | 
			
		||||
    'rule_inferrers' => [
 | 
			
		||||
        Spatie\LaravelData\RuleInferrers\SometimesRuleInferrer::class,
 | 
			
		||||
        Spatie\LaravelData\RuleInferrers\NullableRuleInferrer::class,
 | 
			
		||||
        Spatie\LaravelData\RuleInferrers\RequiredRuleInferrer::class,
 | 
			
		||||
        Spatie\LaravelData\RuleInferrers\BuiltInTypesRuleInferrer::class,
 | 
			
		||||
        Spatie\LaravelData\RuleInferrers\AttributesRuleInferrer::class,
 | 
			
		||||
    ],
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * Normalizers return an array representation of the payload, or null if
 | 
			
		||||
     * it cannot normalize the payload. The normalizers below are used for
 | 
			
		||||
     * every data object, unless overridden in a specific data object class.
 | 
			
		||||
     */
 | 
			
		||||
    'normalizers' => [
 | 
			
		||||
        Spatie\LaravelData\Normalizers\ModelNormalizer::class,
 | 
			
		||||
        // Spatie\LaravelData\Normalizers\FormRequestNormalizer::class,
 | 
			
		||||
        Spatie\LaravelData\Normalizers\ArrayableNormalizer::class,
 | 
			
		||||
        Spatie\LaravelData\Normalizers\ObjectNormalizer::class,
 | 
			
		||||
        Spatie\LaravelData\Normalizers\ArrayNormalizer::class,
 | 
			
		||||
        Spatie\LaravelData\Normalizers\JsonNormalizer::class,
 | 
			
		||||
    ],
 | 
			
		||||
 | 
			
		||||
    /*
 | 
			
		||||
     * Data objects can be wrapped into a key like 'data' when used as a resource,
 | 
			
		||||
     * this key can be set globally here for all data objects. You can pass in
 | 
			
		||||
     * `null` if you want to disable wrapping.
 | 
			
		||||
     */
 | 
			
		||||
    'wrap' => null,
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * Adds a specific caster to the Symphony VarDumper component which hides
 | 
			
		||||
     * some properties from data objects and collections when being dumped
 | 
			
		||||
     * by `dump` or `dd`. Can be 'enabled', 'disabled' or 'development'
 | 
			
		||||
     * which will only enable the caster locally.
 | 
			
		||||
     */
 | 
			
		||||
    'var_dumper_caster_mode' => 'development',
 | 
			
		||||
];
 | 
			
		||||
@ -219,4 +219,8 @@ return [
 | 
			
		||||
        'client_id' => env('SHOPIFY_CLIENT_ID', null),
 | 
			
		||||
        'client_secret' => env('SHOPIFY_CLIENT_SECRET', null),
 | 
			
		||||
    ],
 | 
			
		||||
    'tax_api' => [
 | 
			
		||||
        'provider' => env('TAX_API_PROVIDER', false),
 | 
			
		||||
        'api_key' => env('TAX_API_KEY', false),
 | 
			
		||||
    ]
 | 
			
		||||
];
 | 
			
		||||
 | 
			
		||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user