WeeniehuahuaXD
WeeniehuahuaXD

Reputation: 852

laravel blade showing curly brackets

Here's my controller code:

public function getIndex()
{

    \Eloquent::unguard();

     $users = \DB::table('users')->get();;

     return \View::make('index')->with('users', $users);

}

So nothing fancy whatsoever.

In my view I am displaying the data from the users table:

@foreach ($users as $user) {
    {{$user->email}}
}      
@endforeach

But it seems that all of my output has {} around each iteration, like this:

{ John } { [email protected] }

I'm not sure what is going on and why these brackets are appearing around all of my output or how to get rid of them.

Upvotes: 2

Views: 2662

Answers (1)

Joseph Silber
Joseph Silber

Reputation: 219910

Blade doesn't use curly braces for control flow. Just remove them:

@foreach ($users as $user)
    {{ $user->email }}
@endforeach

Upvotes: 5

Related Questions