Laravel Views: Passing Data To Views

Return view('greetings', ['name' => 'Victoria']);
Return view('greeting')->with('name', 'Victoria');

Ou may use the with method to add individual pieces of data to the view.

Sharing Data With All Views

<?php

namespace App\Providers;

use Illuminate\Support\Facades\View;

class AppServiceProvider extends ServiceProvider
{
    /**
     * Bootstrap any application services.
     *
     * @return void
     */
    public function boot()
    {
        View::share('key', 'value');
    }

    /**
     * Register the service provider.
     *
     * @return void
     */
    public function register()
    {
        //
    }
}

Related concepts

Laravel Views: Passing Data To Views — Structure map

Clickable & Draggable!

Laravel Views: Passing Data To Views — Related pages: