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.
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.
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
You could embed PHP code into your view using @php directive.
(https://laravel.com/docs/6.x/blade#php)