0
I’m developing a listing and I’m having a hard time presenting on the same row of the table data groupBy
I’m not able to list this data on the same line, in case DT_PONTO
returns two values S
for entry and N
for output (and each value has its own ID) and in the html table I wanted these values for two distinct columns.
public function scopes()
{
$workes=Workers::find(20) ;
$date1 = '2015-10-05';
$date2 = '2015-10-05';
$cargos = $workes->cargos()->get('NM_CARGO');
$pontos = $workes->punchcards()->where([
['DT_PONTO', '>=', $date1],
['DT_PONTO', '<=', $date2]
])
->with('markings')->get();
foreach($pontos as $valorP){
$marks = $valorP->markings()->get();
$resultP[]= $valorP;
foreach($marks as $mark){
$resu1=[
'CD_PONTO'=>($mark->CD_PONTO),
'DT_PONTO'=>($valorP->DT_PONTO),
'HR_MARCACAO'=>($mark->HR_MARCACAO)
];
$tes1[] = $resu1;
}}
$retorns1= new Collection($tes1);
$fills = $retorns1->groupBy('VF_ENTRADA');
$fills->toArray();
return view("modules.education.reports.common.table_score_structure", compact( 'retorns','fills'));
}
When I use the ' whereRaw ' of Syntax error, but in case the relationship is between three Workers table, Punchcards, Markings and groupBy would be for the Markings table in which there is a column that records employee input and output and my main problem and that when passing the data to the VIEW I am not getting in the same row of the html table (Blade) puts a value that records employee entry and exit .
– Richard carlos
Pass two Wherehas then
– Lucas Antonio
Group By is going to take all the repeat data and it’s going to gather
– Lucas Antonio
I edited the first whereRaw to be right
– Lucas Antonio