I queried the data from database using a Model.
echo $user = User::whereRaw('username = ? and password = ?', array($username,$password))->get();
The output is in JSON format
[{"id":1,"name":"Abhijith","username":"abhi","created_at":"2014-07-31 20:07:35","updated_at":"2014-07-31 20:07:35"}]
But when I try to echo a single field, I get an index not found error.
echo $user->id; //Gives an error saying the index is not found
echo $user[0]->id;Look at the object, it makes sense. Taking away this superfluous up-vote.