Passar matriz do controlador Laravel com compacto

// Its work For me 

return view('site.dashboard.user_profile')
  ->with(compact('visits','user_details'));
Nipun