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
|
|
|
|
*
|
2020-01-07 01:13:47 +01:00
|
|
|
* @copyright Copyright (c) 2020. 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;
|
|
|
|
use App\Models\Client;
|
|
|
|
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;
|
|
|
|
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;
|
|
|
|
use App\Observers\ClientObserver;
|
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;
|
|
|
|
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;
|
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;
|
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()
|
|
|
|
{
|
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
|
|
|
User::observe(UserObserver::class);
|
|
|
|
Account::observe(AccountObserver::class);
|
|
|
|
Client::observe(ClientObserver::class);
|
|
|
|
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);
|
|
|
|
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);
|
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
|
|
|
}
|
|
|
|
}
|