kamboj
kamboj

Reputation: 411

eloquent query doesn't work properly

i'm trying to query my mysql database with eloquent laravel but it doesn't work.

User::where('id', 1)->first()

however when i try with sql query it works.

DB::table('users')->first()

thanks in advance.

Upvotes: 1

Views: 304

Answers (1)

Nazmul Hasan
Nazmul Hasan

Reputation: 1977

May be you didn't use your User namespace. If not, use your User model namespace in controller.

Upvotes: 1

Related Questions