0
How to use compact function in php 7.3.9
13 odpowiedzi
+ 3
Is it possible to analyse what <$users> variable content is? just in case ...
You wrote "Compact" there, I take it was a typo? cause PHP is case sensitive (you know).
Also view('showAttendance ... had a single quote in the beginning. Was that also a typo perhaps?
+ 2
Yes, I was asking you, is there a way to preview the content of <$requests> variable. This information is necessary.
Since you changed the variable from <$users> to <$requests>, is it perhaps the cause why <$users> is not recognized in the view? just a guess ...
+ 1
Explain "not working", like you get an error message, or what?
+ 1
Is <$requests> variable totally unrecognized in there?
Can you perhaps just dump its content to see what's inside?
I'm not sure what's wrong ...
0
I am working in laravel 5.8 its not working here
0
I want to fetch data from database in view table i use conpact function in controller and foreach loop in view file when i used variable in foreach loop in view file it gives me undefined variable error
0
Here is my controller
Public function index(){
$users=DB::table('requests')->get();
return view('showAttendance, Compact
('users'));
}
And my view is
@foreach($users as $user)
<td>{{$user->date}}</td>
<td>{{$user->name}}</td>
0
$requests=DB::table('requests')->get(); this is my variable
0
return view('showAttendanece', compact('requests')); that is my return
0
This is my showAttendance view want to fetch data from database dynamically and show in table
@foreach($requests as $user)
<td>{{$user->date}}</td>
<td>{{$user->name}}</td>
0
Problem is in this $requests variable which i decleared in my controller index function
0
It gives null value after dump