Skip to content
Advertisement

Unknown column “has” in ‘where clause

I am using laravel 5.7

When I use whereHas to check a relation’s existence, I face with Unknown column "has" in 'where clause Error! Why?

this is my code:

JavaScript

and this is my model part:

JavaScript

Update:

The query was started with:

JavaScript

Advertisement

Answer

I have found my problem, I was using DB::table('tablename') instead of using the Model (TableName:: ...)

Thanks for all answers

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