Support the ongoing development of Laravel.io →
Requests Input
Last updated 1 year ago.
0

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();

0

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
Last updated 9 years ago.
0

I have done. No problem. Thanks

0

Sign in to participate in this thread!

Eventy

Your banner here too?

DiegoHeras diegoheras Joined 26 Dec 2014

Moderators

We'd like to thank these amazing companies for supporting us

Your logo here?

Laravel.io

The Laravel portal for problem solving, knowledge sharing and community building.

© 2024 Laravel.io - All rights reserved.