0

Why do i get this error? I have the right relationships and in tinker, it works really well, do u guys have any idea about this?

Tinker: enter image description here

Controller:

$emp = Empresa::find($request->empresa_id);
$mov = $emp->movimientos()->where('linea_id', intval($request->id_caso))->with('producto_nombre', 'costo_promedio');
return DataTables::of($mov)->make(true);

Error: enter image description here

Table structure: enter image description here

Thx for the help.

1
  • since there are multiple table in your query you must specify the table name in your condition movimiento.linea_id Commented Sep 26, 2018 at 2:57

1 Answer 1

1

ambiguous error occurs when there are multiple columns with the same name and you dont specified its table

since there are multiple table and have a column with the same name in your query you must specify the table name in your condition

$emp = Empresa::find($request->empresa_id);
$mov = $emp->movimientos()->where('movimiento.linea_id', intval($request->id_caso))->with('producto_nombre', 'costo_promedio');
return DataTables::of($mov)->make(true);
Sign up to request clarification or add additional context in comments.

1 Comment

It's working now, how a simple thing can make u waste so much time... thank you so much

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.