skip to Main Content

Mysql function fails in Laravel tests

I have a query below that retrieves groups from the database; it works fine except when I run it through pest php test case and hit the controller; the test fails and says IlluminateDatabaseQueryException: SQLSTATE[HY000]: General error: 1 no such…

VIEW QUESTION

How to query field created by addSelect in Laravel?

I have the following query where I am adding three new columns by using the addSelect function DB::connection('mysql_slave') ->table('applications') ->whereNull('applications.deleted_at') ->when($column != 'contract_return_date' && $column != 'contract_delivery_date',function ($query) use ($column,$date_from,$date_to){ return $query->whereBetween('applications.'.$column, [$date_from, $date_to]); }) ->join('customers','applications.customer_id','=','customers.id') ->join('departments','applications.department_id','=','departments.id') ->select([ 'applications.id', 'applications.customer_id',…

VIEW QUESTION
Back To Top
Search