SQLSTATE[42S22]: Column not found: 1054 Unknown column 'category' in 'where clause' (SQL: select count(*) as aggregate from (select '1' as row_count from articles inner join languages on languages.id = articles.language_id inner join article_categories on article_categories.id = articles.article_category_id where articles.deleted_at is null and (LOWER(articles.id) LIKE %k% or LOWER(articles.title) LIKE %k% or LOWER(category) LIKE %k% or LOWER(languages.name) LIKE %k% or LOWER(articles.created_at) LIKE %k%)) count_row_table)
@davidpiesse | @phpclub | @frankperez87 | @jarnix My Data Control
public function data() { $article = Article::join('languages', 'languages.id', '=', 'articles.language_id') ->join('article_categories', 'article_categories.id', '=', 'articles.article_category_id') ->select(array('articles.id','articles.title','article_categories.title as category', 'languages.name', 'articles.created_at'));
}
When use search box
SQLSTATE[42S22]: Column not found: 1054 Unknown column 'category' in 'where clause' (SQL: select count(*) as aggregate from (select '1' as row_count from
articles
inner joinlanguages
onlanguages
.id
=articles
.language_id
inner joinarticle_categories
onarticle_categories
.id
=articles
.article_category_id
wherearticles
.deleted_at
is null and (LOWER(articles
.id
) LIKE %k% or LOWER(articles
.title
) LIKE %k% or LOWER(category
) LIKE %k% or LOWER(languages
.name
) LIKE %k% or LOWER(articles
.created_at
) LIKE %k%)) count_row_table)Please help me to fix this.