Closed
Description
I might be doing something wrong here but I followed the very basic example from the docs.
I'm simple retrieving all the users from the database which is empty but I get a Collection object back with 2 protected variables so my result isn't really 'empty'.
PHP code in the Controller:
class UsersController extends BaseController {
public function index()
{
$users = User::all();
var_dump($users);
return View::make('admin.users.index')->with('users', $users);
}
}
Response from var_dump
:
object(Illuminate\Database\Eloquent\Collection)#130 (2) { ["items":protected]=> array(0) { } ["dictionary":protected]=> array(0) { } }
This means that I can't do the following in a Blade view because it will always pass the if statement:
@if($users)
The user model is pretty basic:
class User extends Eloquent {
protected $table = 'users';
}
Any ideas? :-/
Metadata
Metadata
Assignees
Labels
No labels