1namespace App\Providers;
2use Illuminate\Support\Facades\View;
3use Illuminate\Support\ServiceProvider;
4use Illuminate\Support\Facades\Schema;
5
6use Illuminate\Support\Facades\Auth;
7use DB;
8
9
10class AppServiceProvider extends ServiceProvider
11{
12 /**
13 * Bootstrap any application services.
14 *
15 * @return void
16 */
17 public function boot()
18 {
19 View::share('key', 'value');
20 Schema::defaultStringLength(191);
21
22 $categories=DB::table('categories')->get();
23 View::share('categories',$categories);
24
25 }
26
27 /**
28 * Register any application services.
29 *
30 * @return void
31 */
32 public function register()
33 {
34 //
35 }
36}
37
1<?php
2
3namespace App\Providers;
4
5use Illuminate\Support\Facades\View;
6
7class AppServiceProvider extends ServiceProvider
8{
9 /**
10 * Register any application services.
11 *
12 * @return void
13 */
14 public function register()
15 {
16 //
17 }
18
19 /**
20 * Bootstrap any application services.
21 *
22 * @return void
23 */
24 public function boot()
25 {
26 View::share('key', 'value');
27 }
28}