Laravel - Blade Templates - Displaying Data

You may display data that is passed to your Blade views by wrapping the variable in curly braces. For example, given the following route:

    Route::get('/', function () {
        return view('welcome', ['name' => 'Samantha']);

You may display the contents of the name variable like so:

    Hello, {{ $name }}.
Blade's {{ }} echo statements are automatically sent through PHP's htmlspecialchars function to prevent XSS attacks.

You are not limited to displaying the contents of the variables passed to the view. You may also echo the results of any PHP function. In fact, you can put any PHP code you wish inside of a Blade echo statement:

    The current UNIX timestamp is {{ time() }}.