Skip to content
Advertisement

Undefined property: IlluminateDatabaseMySqlConnection::$Id

I was trying to pass a parameter from my database to my view.

Controller

JavaScript

Route

JavaScript

Blade/View

JavaScript

And from PHPMyAdmin, we can see a table named statisticforteacher, and each column name is also right.

enter image description here

However, I still get the following error.

ErrorException Undefined property: IlluminateDatabaseMySqlConnection::$Id

Advertisement

Answer

JavaScript

Here $data return query builder instance so you have to return collection in order to loop data so you have to use

JavaScript

or

JavaScript

if you have addition query condition then you have use get() not all() method

User contributions licensed under: CC BY-SA
3 People found this is helpful
Advertisement