Hi Friends I am trying to store csv file in local laravel storage folder but I am getting this error Array to string conversion. please suggest me.
Controller
$user=DB::table('users as u')
->join('emp as e', 'u.EmpID', '=', 'e.EmpID')
->select('e.DATE as Date', 'e.EmpID as EmpID', 'e.job as Work')
->get();
$data = array();
foreach ($user as $result) {
$temp = (array)$result;
$temp['L'] = 'L';
$data[] = $temp;
}
Storage::disk('csv')->put('users_'.date('m-d-y').'.csv',$data);
Expected Output in CSV File:
Date EmpID Work
25/08/16 123 House Cleaning
28/08/116 345 blahblah
Output Coming like this in CSV File:
The page is showing Array to string conversion Error:
ArrayArrayArray
via Chebli Mohamed
Aucun commentaire:
Enregistrer un commentaire