Get data from database in blade

Viewed 356

I am new in laravel. is there any way to get data from database directly to the blade.php without using controller ?

I want to hide a menu 'my Form' when user is not filled any form.

2 Answers

You have to use like below

@php
    $data = \App\Models\User::all();
@endphp

or just use like below

@foreach(\App\Models\User::all() as $user)

@endforeach
Related