25 lines
581 B
PHP
25 lines
581 B
PHP
<?php
|
|
|
|
namespace App\Providers;
|
|
|
|
use App\Models\Engagement;
|
|
use Illuminate\Support\ServiceProvider;
|
|
use Illuminate\Support\Facades\Schema;
|
|
use Illuminate\Support\Facades\View;
|
|
|
|
class ViewServiceProvider extends ServiceProvider
|
|
{
|
|
/**
|
|
* Bootstrap any application services.
|
|
*
|
|
* @return void
|
|
*/
|
|
public function boot(): void
|
|
{
|
|
// Shares this data with all views.
|
|
if (Schema::hasTable('engagements')) {
|
|
$globalEngagements = Engagement::get();
|
|
View::share('globalEngagements', $globalEngagements);
|
|
}
|
|
}
|
|
}
|