Ahmed Albarody
Ahmed Albarody

Reputation: 177

PHP Fatal error: Call to undefined function table() in eval()'d code on line 1 Laravel Artisan Tinker

I'm having a problem with learning Laravel so I decided to follow a tutorial at laracast hoping that I could understand something at the end,

I installed homestead and "SSh"ed into my VM and into "~/Code/Laravel" and tried to work with tinker as they did on the tutorial ,, Tinker works but wont execute any command not even a simple selection like (>>> DB:table('projects')-get()) , but keeps giving me the following error:

PHP Fatal error:  Call to undefined function table() in eval()'d code on line 1

screen shot of the terminal attached I can run simple mathematical operations and echo commands, but noting related to database, although I migrated the table (projects) successfully, and I was planing to seed it through tinker (by seed I mean input some data into it - is that what seed means in the first place? -).

my OS is Ubuntu if it matters!

thank you in advance!

Upvotes: 0

Views: 2301

Answers (1)

Peter Harizanov
Peter Harizanov

Reputation: 26

I saw the attached screen shot. The solution is simple. Instead of

DB:table('card')-get();

you need to write

DB::table('card')->get();

Upvotes: 1

Related Questions