Search
 
SCRIPT & CODE EXAMPLE
 

PHP

Pass all data to all pages laravel

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);
  }
}
Comment

Pass all data to all pages laravel

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()
    {
        //
    }
}
Comment

Pass all data to all pages laravel

this work :)
use IlluminateSupportFacadesView;
Comment

PREVIOUS NEXT
Code Example
Php :: order by in datatable laravel 
Php :: array unique php 
Php :: show data from a table in laravel 8 
Php :: php exception import 
Php :: Line : 83 -- syntax error, unexpected end of file php 
Php :: show alert in php 
Php :: ubuntu install php 8 nginx 
Php :: remove item from collection 
Php :: PHP file reading modes with explaination 
Php :: how to send data from one website to another in php 
Php :: php checking if array is multidimensional or not 
Php :: where is php.ini file in ubuntu 
Php :: wordpress get post type 
Php :: duplicate record laravel 
Php :: foreach reverse laravel 
Php :: cut long text laravel blade 
Php :: laravel Your requirements could not be resolved to an installable set of packages. 
Php :: array collapse laravel 
Php :: default value date symfony entity 
Php :: string to array in php 
Php :: cannot use font awesome in php mvc 
Php :: php foreach index 
Php :: laravel make component 
Php :: date format change in laravel blade 
Php :: delete model laravel 
Php :: Generating Random String In PHP Using uniqid() function 
Php :: array constant in php 
Php :: Woocommerce remove add to cart message 
Php :: laravel append 
Php :: php Convert String containing commas to array 
ADD CONTENT
Topic
Content
Source link
Name
4+4 =