I tried to count an array by plunk (), by means of a foreach, but for some reason it always remains in the first element and does not tell me the rest, should I use each ()?
* @return \Illuminate\Http\Response
*/
public function reportes(Request $request)
{
$request->user()->authorizeRoles(['admin']);
$reporuser=usuarios::pluck('usuario_ad', 'user_id')->unique();
foreach($reporuser as $reporuse)
{
$conteo=usuarios::where('usuario_ad',$reporuse);
return view('usuario.reportes',compact('conteo'));
}
}
UPDATE
I want it to count all the users that a user has entered
Rather, I just want to do a foreach to tell me everything in this,
$reporuser=usuarios::pluck('usuario_ad', 'user_id')->unique();
but with the foreach I do, only one element comes out and the others do not.