2018-10-04 19:10:43 +02:00
|
|
|
<?php
|
2019-05-11 05:32:07 +02:00
|
|
|
/**
|
2020-09-06 11:38:10 +02:00
|
|
|
* Invoice Ninja (https://invoiceninja.com).
|
2019-05-11 05:32:07 +02:00
|
|
|
*
|
|
|
|
* @link https://github.com/invoiceninja/invoiceninja source repository
|
|
|
|
*
|
2021-01-03 22:54:54 +01:00
|
|
|
* @copyright Copyright (c) 2021. Invoice Ninja LLC (https://invoiceninja.com)
|
2019-05-11 05:32:07 +02:00
|
|
|
*
|
|
|
|
* @license https://opensource.org/licenses/AAL
|
|
|
|
*/
|
2018-10-04 19:10:43 +02:00
|
|
|
|
|
|
|
namespace App\Providers;
|
|
|
|
|
2019-04-20 00:27:37 +02:00
|
|
|
use App\Models\Account;
|
2021-03-05 11:18:28 +01:00
|
|
|
use App\Models\BillingSubscription;
|
2019-04-20 00:27:37 +02:00
|
|
|
use App\Models\Client;
|
2021-03-05 11:18:28 +01:00
|
|
|
use App\Models\ClientSubscription;
|
2019-04-20 00:27:37 +02:00
|
|
|
use App\Models\Company;
|
2020-08-22 02:42:12 +02:00
|
|
|
use App\Models\CompanyGateway;
|
2019-04-20 00:27:37 +02:00
|
|
|
use App\Models\CompanyToken;
|
2021-02-15 11:52:50 +01:00
|
|
|
use App\Models\Credit;
|
2019-04-20 00:27:37 +02:00
|
|
|
use App\Models\Expense;
|
|
|
|
use App\Models\Invoice;
|
|
|
|
use App\Models\Payment;
|
|
|
|
use App\Models\Product;
|
|
|
|
use App\Models\Proposal;
|
|
|
|
use App\Models\Quote;
|
|
|
|
use App\Models\Task;
|
|
|
|
use App\Models\User;
|
|
|
|
use App\Observers\AccountObserver;
|
2021-03-05 11:18:28 +01:00
|
|
|
use App\Observers\BillingSubscriptionObserver;
|
2019-04-20 00:27:37 +02:00
|
|
|
use App\Observers\ClientObserver;
|
2021-03-05 11:18:28 +01:00
|
|
|
use App\Observers\ClientSubscriptionObserver;
|
2020-08-22 02:42:12 +02:00
|
|
|
use App\Observers\CompanyGatewayObserver;
|
2019-04-20 00:27:37 +02:00
|
|
|
use App\Observers\CompanyObserver;
|
|
|
|
use App\Observers\CompanyTokenObserver;
|
2021-02-15 11:52:50 +01:00
|
|
|
use App\Observers\CreditObserver;
|
2019-04-20 00:27:37 +02:00
|
|
|
use App\Observers\ExpenseObserver;
|
|
|
|
use App\Observers\InvoiceObserver;
|
|
|
|
use App\Observers\PaymentObserver;
|
|
|
|
use App\Observers\ProductObserver;
|
|
|
|
use App\Observers\ProposalObserver;
|
|
|
|
use App\Observers\QuoteObserver;
|
|
|
|
use App\Observers\TaskObserver;
|
|
|
|
use App\Observers\UserObserver;
|
2021-02-08 11:11:17 +01:00
|
|
|
use Illuminate\Cache\RateLimiting\Limit;
|
2018-10-22 14:04:37 +02:00
|
|
|
use Illuminate\Database\Eloquent\Relations\Relation;
|
2020-08-11 02:48:05 +02:00
|
|
|
use Illuminate\Queue\Events\JobProcessing;
|
2018-10-22 14:04:37 +02:00
|
|
|
use Illuminate\Support\Facades\Blade;
|
2020-08-11 02:48:05 +02:00
|
|
|
use Illuminate\Support\Facades\Queue;
|
2021-02-08 11:11:17 +01:00
|
|
|
use Illuminate\Support\Facades\RateLimiter;
|
2019-04-20 00:14:52 +02:00
|
|
|
use Illuminate\Support\Facades\Schema;
|
2018-10-04 19:10:43 +02:00
|
|
|
use Illuminate\Support\ServiceProvider;
|
2020-03-28 12:34:04 +01:00
|
|
|
|
2018-10-04 19:10:43 +02:00
|
|
|
class AppServiceProvider extends ServiceProvider
|
|
|
|
{
|
|
|
|
/**
|
|
|
|
* Bootstrap any application services.
|
|
|
|
*
|
|
|
|
* @return void
|
|
|
|
*/
|
|
|
|
public function boot()
|
|
|
|
{
|
2021-02-08 11:11:17 +01:00
|
|
|
|
|
|
|
/* Limits the number of parallel jobs fired per minute when checking data*/
|
|
|
|
RateLimiter::for('checkdata', function ($job) {
|
|
|
|
return Limit::perMinute(100);
|
|
|
|
});
|
|
|
|
|
2018-10-22 14:04:37 +02:00
|
|
|
Relation::morphMap([
|
2020-10-28 11:10:49 +01:00
|
|
|
'invoices' => Invoice::class,
|
2020-09-22 08:11:32 +02:00
|
|
|
// 'credits' => \App\Models\Credit::class,
|
2020-10-28 11:10:49 +01:00
|
|
|
'proposals' => Proposal::class,
|
2018-10-22 14:04:37 +02:00
|
|
|
]);
|
|
|
|
|
2019-12-30 22:59:12 +01:00
|
|
|
Blade::if('env', function ($environment) {
|
2018-10-22 14:04:37 +02:00
|
|
|
return config('ninja.environment') === $environment;
|
|
|
|
});
|
2019-04-20 00:14:52 +02:00
|
|
|
|
|
|
|
Schema::defaultStringLength(191);
|
|
|
|
|
2019-04-20 00:27:37 +02:00
|
|
|
Account::observe(AccountObserver::class);
|
2021-03-05 11:18:28 +01:00
|
|
|
BillingSubscription::observe(BillingSubscriptionObserver::class);
|
2019-04-20 00:27:37 +02:00
|
|
|
Client::observe(ClientObserver::class);
|
2021-03-05 11:18:28 +01:00
|
|
|
ClientSubscription::observe(ClientSubscriptionObserver::class);
|
2019-04-20 00:27:37 +02:00
|
|
|
Company::observe(CompanyObserver::class);
|
2020-08-22 02:42:12 +02:00
|
|
|
CompanyGateway::observe(CompanyGatewayObserver::class);
|
2019-04-20 00:27:37 +02:00
|
|
|
CompanyToken::observe(CompanyTokenObserver::class);
|
2021-02-15 11:52:50 +01:00
|
|
|
Credit::observe(CreditObserver::class);
|
2019-04-20 00:27:37 +02:00
|
|
|
Expense::observe(ExpenseObserver::class);
|
|
|
|
Invoice::observe(InvoiceObserver::class);
|
|
|
|
Payment::observe(PaymentObserver::class);
|
|
|
|
Product::observe(ProductObserver::class);
|
|
|
|
Proposal::observe(ProposalObserver::class);
|
|
|
|
Quote::observe(QuoteObserver::class);
|
|
|
|
Task::observe(TaskObserver::class);
|
2021-03-05 11:18:28 +01:00
|
|
|
User::observe(UserObserver::class);
|
2020-03-28 12:34:04 +01:00
|
|
|
|
|
|
|
// Queue::before(function (JobProcessing $event) {
|
2020-04-01 10:54:22 +02:00
|
|
|
// // \Log::info('Event Job '.$event->connectionName);
|
|
|
|
// \Log::error('Event Job '.$event->job->getJobId);
|
|
|
|
// // \Log::info('Event Job '.$event->job->payload());
|
2020-03-28 12:34:04 +01:00
|
|
|
// });
|
2020-04-01 10:54:22 +02:00
|
|
|
//! Update Posted AT
|
2020-03-28 12:34:04 +01:00
|
|
|
// Queue::after(function (JobProcessed $event) {
|
2020-04-01 10:54:22 +02:00
|
|
|
// // \Log::info('Event Job '.$event->connectionName);
|
|
|
|
// \Log::error('Event Job '.$event->job->getJobId);
|
|
|
|
// // \Log::info('Event Job '.$event->job->payload());
|
2020-03-28 12:34:04 +01:00
|
|
|
// });
|
2018-10-04 19:10:43 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Register any application services.
|
|
|
|
*
|
|
|
|
* @return void
|
|
|
|
*/
|
|
|
|
public function register()
|
|
|
|
{
|
2019-01-22 10:47:26 +01:00
|
|
|
$this->loadHelpers();
|
|
|
|
}
|
|
|
|
|
|
|
|
protected function loadHelpers()
|
|
|
|
{
|
|
|
|
foreach (glob(__DIR__.'/../Helpers/*.php') as $filename) {
|
|
|
|
require_once $filename;
|
|
|
|
}
|
2018-10-04 19:10:43 +02:00
|
|
|
}
|
|
|
|
}
|