Reputation: 189
I'm just new in Laravel 4 and currently I'm reading the documentation. I apply some of the quickstart code tutorial and here what it turns out.
routes.php
Route::get('/users', 'UserController@showUsers');
layout.blade.php
<html>
<body>
<h1>Laravel Quickstart</h1>
@yield('content')
</body>
</html>
users.blade.php
@extends('layout')
@section('content')
@foreach($users as $user)
<p>{{ $user->name }}</p>
@endforeach
@stop
UserController.php
class UserController extends BaseController {
public function showUsers()
{
$users = User::all();
return View::make('users.layout')->with('users', $users);
}
}
When I to call directly
{{ $users }}
in layout.blade.php it works pretty fine but why isn't working in users.blade.php?
Thanks, :)
Upvotes: 0
Views: 1172
Reputation: 12169
Replace this line
return View::make('users.layout')->with('users', $users);
With this
return View::make('users.users')->with('users', $users);
Upvotes: 1