56 lines
1.4 KiB
PHP
56 lines
1.4 KiB
PHP
<?php
|
|
|
|
namespace App\Providers;
|
|
|
|
use Illuminate\Database\Schema\Blueprint;
|
|
use Illuminate\Support\Facades\Schema;
|
|
use Illuminate\Support\ServiceProvider;
|
|
use Illuminate\Support\Facades\View;
|
|
use App\Models\Publication;
|
|
|
|
class AppServiceProvider extends ServiceProvider
|
|
{
|
|
/**
|
|
* Register any application services.
|
|
*
|
|
* @return void
|
|
*/
|
|
public function register()
|
|
{
|
|
//
|
|
if ($this->app->environment('local')) {
|
|
$this->app->register(\Laravel\Telescope\TelescopeServiceProvider::class);
|
|
$this->app->register(TelescopeServiceProvider::class);
|
|
}
|
|
|
|
}
|
|
|
|
/**
|
|
* Bootstrap any application services.
|
|
*
|
|
* @return void
|
|
*/
|
|
public function boot(): void
|
|
{
|
|
// Only needed for older MySQL versions (< 5.7.7)
|
|
Schema::defaultStringLength(191);
|
|
|
|
// Language switcher composer
|
|
// View::composer('partials.language_switcher', function ($view) {
|
|
// $view->with('current_locale', app()->getLocale());
|
|
// $view->with('available_locales', config('app.available_locales'));
|
|
// });
|
|
|
|
// Shared publications message
|
|
$publications = Publication::query()
|
|
->whereRaw('CURDATE() BETWEEN start_date AND end_date')
|
|
->where('record_status_id', 1)
|
|
->orderByDesc('id')
|
|
->get();
|
|
|
|
View::share([
|
|
'sharedMessage' => $publications,
|
|
]);
|
|
}
|
|
}
|