1
0
mirror of https://github.com/invoiceninja/invoiceninja.git synced 2024-11-06 03:02:34 +01:00
invoiceninja/app/Providers/AppServiceProvider.php

112 lines
3.3 KiB
PHP
Raw Normal View History

2018-10-04 19:10:43 +02:00
<?php
2019-05-11 05:32:07 +02:00
/**
* Invoice Ninja (https://invoiceninja.com).
2019-05-11 05:32:07 +02:00
*
* @link https://github.com/invoiceninja/invoiceninja source repository
*
* @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;
use Illuminate\Database\Eloquent\Relations\Relation;
2020-08-11 02:48:05 +02:00
use Illuminate\Queue\Events\JobProcessing;
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;
2018-10-04 19:10:43 +02:00
class AppServiceProvider extends ServiceProvider
{
/**
* Bootstrap any application services.
*
* @return void
*/
public function boot()
{
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,
]);
Blade::if('env', function ($environment) {
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);
// Queue::before(function (JobProcessing $event) {
// // \Log::info('Event Job '.$event->connectionName);
// \Log::error('Event Job '.$event->job->getJobId);
// // \Log::info('Event Job '.$event->job->payload());
// });
//! Update Posted AT
// Queue::after(function (JobProcessed $event) {
// // \Log::info('Event Job '.$event->connectionName);
// \Log::error('Event Job '.$event->job->getJobId);
// // \Log::info('Event Job '.$event->job->payload());
// });
2018-10-04 19:10:43 +02:00
}
/**
* Register any application services.
*
* @return void
*/
public function register()
{
$this->loadHelpers();
}
protected function loadHelpers()
{
foreach (glob(__DIR__.'/../Helpers/*.php') as $filename) {
require_once $filename;
}
2018-10-04 19:10:43 +02:00
}
}