Answer the question
In order to leave comments, you need to log in
Why doesn't the where method work in Laravel?
Good day, I ran into the following problem - I was developing a site on Laravel. There is a table of products, the user can review the product, after which the admin approves the review (in the review table, the 'is_approved' field becomes equal to 1, by default 0). In the database I use tinyint for the 'is_approved' field. To get all approved reviews I use the following code:
where
reviews is a one-to-many relationship between the product and
reviews
table what could be the problem? The php versions on the local machine and on the server are the same. $this->reviews->where('is_approved', 1);
$this->reviews->where('is_approved', '1');
$reviews->where('is_approved', 1);
Answer the question
In order to leave comments, you need to log in
have you tried it like this return $this->reviews->where('is_approved', true);
?
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question