How to print string in Laravel blade?

Created 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

If you like what you are reading, please consider buying us a coffee ( or 2 ) as a token of appreciation.

Buy Me A Coffee

Don't forget to share this article! Help us spread the word by clicking the share button below.

We appreciate your support and are committed to providing you valuable and informative content.

We are thankful for your never ending support.