How to print string in Laravel blade?

Updated at 22-Aug-2022, By samar

How to print string in Laravel blade?

With this article, we’ll look at some examples of how to address the "How to print string in Laravel blade?" problem.

You can print string data using `{{ $data }}` in Laravel blade. You have to pass the string value to the `$data` variable after that you can return it to the blade file and display it.
  • app\Http\Controllers\<HomeController>.php

    Code in controller method

    $data = "It is a long established fact that a reader will be distracted by the readable content of a page when looking at its layout. 
    The point of using Lorem Ipsum is that it has a more-or-less normal distribution of letters, 
    as opposed to using 'Content here, content here', making it look like readable English.";
    
    return view('home', compact('data'));
    

    resources\views\home.blade.php

    {{ $data }}
    

Back to code snippet queries related laravel