use IlluminateSupportFacadesView;
class BaseController extends Controller
{
public function __construct()
{
//its just a dummy data object.
$user = User::all();
// Sharing is caring
View::share('user', $user);
}
}
namespace AppProviders;
use IlluminateSupportFacadesView;
use IlluminateSupportServiceProvider;
use IlluminateSupportFacadesSchema;
use IlluminateSupportFacadesAuth;
use DB;
class AppServiceProvider extends ServiceProvider
{
/**
* Bootstrap any application services.
*
* @return void
*/
public function boot()
{
View::share('key', 'value');
Schema::defaultStringLength(191);
$categories=DB::table('categories')->get();
View::share('categories',$categories);
}
/**
* Register any application services.
*
* @return void
*/
public function register()
{
//
}
}
this work :)
use IlluminateSupportFacadesView;