2020-11-18 10:23:51 +01:00
|
|
|
<?php
|
|
|
|
|
|
|
|
|
|
namespace App\Providers;
|
|
|
|
|
|
2021-05-21 16:02:29 +02:00
|
|
|
use App\Enums\TicketStatus;
|
|
|
|
|
use App\Models\Ticket;
|
2021-04-15 16:47:57 +02:00
|
|
|
use Illuminate\Pagination\Paginator;
|
2021-07-30 00:33:18 +02:00
|
|
|
use Illuminate\Support\Facades\File;
|
2021-06-18 15:39:19 +02:00
|
|
|
use Illuminate\Support\Facades\URL;
|
2021-05-21 16:02:29 +02:00
|
|
|
use Illuminate\Support\Facades\View;
|
2020-11-18 10:23:51 +01:00
|
|
|
use Illuminate\Support\ServiceProvider;
|
|
|
|
|
|
|
|
|
|
class AppServiceProvider extends ServiceProvider
|
|
|
|
|
{
|
|
|
|
|
/**
|
|
|
|
|
* Register any application services.
|
|
|
|
|
*
|
|
|
|
|
* @return void
|
|
|
|
|
*/
|
|
|
|
|
public function register()
|
|
|
|
|
{
|
|
|
|
|
//
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Bootstrap any application services.
|
|
|
|
|
*
|
|
|
|
|
* @return void
|
|
|
|
|
*/
|
|
|
|
|
public function boot()
|
|
|
|
|
{
|
2021-04-15 16:47:57 +02:00
|
|
|
Paginator::useBootstrap();
|
2021-06-18 15:39:19 +02:00
|
|
|
if (config('app.env') !== 'local') {
|
|
|
|
|
URL::forceScheme('https');
|
2020-11-24 14:03:47 +01:00
|
|
|
}
|
2021-05-21 16:02:29 +02:00
|
|
|
|
2021-07-30 00:33:18 +02:00
|
|
|
$appInfos = json_decode(File::get(\app_path('../composer.json')));
|
|
|
|
|
|
|
|
|
|
View::share('name', $appInfos->name);
|
|
|
|
|
View::share('version', $appInfos->version);
|
|
|
|
|
View::share('license', $appInfos->license);
|
|
|
|
|
|
2021-05-21 16:02:29 +02:00
|
|
|
View::share('ticketsNew', Ticket::where('status', TicketStatus::new())->count());
|
2021-08-01 13:44:08 +02:00
|
|
|
View::share('ticketsWaiting', Ticket::where('status', TicketStatus::waiting())->count());
|
2021-05-21 16:02:29 +02:00
|
|
|
View::share('ticketsInProgress', Ticket::whereNotIn(
|
|
|
|
|
'status',
|
|
|
|
|
[
|
|
|
|
|
TicketStatus::new(),
|
|
|
|
|
TicketStatus::estimateTodo(),
|
|
|
|
|
TicketStatus::estimateValidated(),
|
|
|
|
|
TicketStatus::toPlan(),
|
|
|
|
|
TicketStatus::planned(),
|
2021-08-01 13:44:08 +02:00
|
|
|
TicketStatus::waiting(),
|
2021-05-21 16:02:29 +02:00
|
|
|
TicketStatus::production(),
|
|
|
|
|
TicketStatus::archived()
|
|
|
|
|
]
|
|
|
|
|
)->count());
|
2020-11-18 10:23:51 +01:00
|
|
|
}
|
|
|
|
|
}
|