Level 23
so what is table1.test whats the actual thing?
why is it that in the first when you have model.name and in other you have table1.test.. :s
only you know your code so you have made some sort of error..
I have two tables that relate to each other I need to make a query that takes data in both, and then make a pagination with the result.
I have a code like this:
return Model::with(['table1'])
->when(($parameters['name']), function ($query) use ($parameters) {
return $query->where('model.name','like','%'.$parameters["name"].'%');
})
->when($parameters['test'], function ($query) use ($parameters) {
return $query->where('table1.test','like','%'.$parameters["test"].'%');
})
->paginate(15);
This code for example, return this error:
Column not found: 1054 Unknown column 'table1.test' in 'where clause' (SQL: select count(*) > as aggregate from
modelwheretable1.testlike %value%)
Please or to participate in this conversation.