W
W
wedytd2022-03-27 19:09:43
Laravel
wedytd, 2022-03-27 19:09:43

How to display text from laravel 8 database?

I have an authorization form, I want where it is marked to display the text not in html but from the database, I have an infos table (It has id and text) and an Info controller.
62408c03200e9018810816.png
welcome.blade.php

<section class="right__block_text">
        Текст
</section>

Answer the question

In order to leave comments, you need to log in

1 answer(s)
R
romaaa32, 2022-03-28
@romaaa32

In controller:

return view('welcome', [
   'text' => 'Текст из бд',
]);

Where 'text'is the name of the variable used in the view.
In the view:
<section class="right__block_text">
        {{$text}}
</section>

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question