You forgot to fetch the rows from your query. To do that don't forget to use get() at the end of the query.
Fetch the rows like this:
$users = User::where('number', '=', 1)->get();
Thanks is perfect. Now i want to make something like a if else but with foreach. Is it posible?
@if ($users)
@foreach ($users as $user)
<p>This is user {{ $user->id }}</p>
@endforeach
@else
No users
@endif
Sign in to participate in this thread!
The Laravel portal for problem solving, knowledge sharing and community building.
The community