New Initial Commit
This commit is contained in:
@@ -0,0 +1,34 @@
|
||||
<?php
|
||||
|
||||
namespace App\Providers;
|
||||
|
||||
use Illuminate\Support\Facades\URL;
|
||||
use Illuminate\Support\Facades\View;
|
||||
use Illuminate\Support\ServiceProvider;
|
||||
|
||||
class AppServiceProvider extends ServiceProvider
|
||||
{
|
||||
/**
|
||||
* Register any application services.
|
||||
*/
|
||||
public function register(): void
|
||||
{
|
||||
//
|
||||
}
|
||||
|
||||
/**
|
||||
* Bootstrap any application services.
|
||||
*/
|
||||
public function boot(): void
|
||||
{
|
||||
if (config('app.env') === 'production' || request()->server('HTTP_X_FORWARDED_PROTO') === 'https') {
|
||||
URL::forceScheme('https');
|
||||
}
|
||||
|
||||
// Share cart count with all views
|
||||
View::composer('*', function ($view) {
|
||||
$cartCount = session('cart') ? count(session('cart')) : 0;
|
||||
$view->with('cartCount', $cartCount);
|
||||
});
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user