I'm inserting a group of elements in database, I'm trying to get one element for each row but I'm obtaining all elements in one row and every row from the database is repeated like this
I would like to get one element for row in the column.. I'm using this query
$data = DB::table('incidencias')
->join('clientes_incid', 'clientes_incid.rif', '=', 'incidencias.rif')
->select('incidencias.rif')
->distinct()
->get();
foreach ($data as $val) {
DB::table('clientes_view')->insert(['resultado' => $data]);
How could I fix it?
