lundi 27 avril 2020

How to replace/convert double slash to single slash in filesystem laravel 5.8

I want to store excel file to local disk in my server, and do with filesystem in laravel 5.8. This is my filesystem config.

'trading' => [
   'driver' => 'local',
   'root'   => 'C:\Users\Administrator\Documents\SPOP\tradingid',
]

And for do store the excel file, i'm using maatwebsite package like this

public function generate(Request $request){
    $now = date("Y-m-d");
    $id_trans = Transaction::whereIn('id', $request->ids)->pluck('transaction_id');

    $data = Excel::store(new ExportData($id_trans), 'ExcelFile'.$now.'xlsx', 'trading');

    if ($data) {
       return response()->json(['status' => 'success', 'message' => 'Success To Generate']);
    } else {
       return response()->json(['status' => 'error', 'message' => 'Failed To Generate']);
    }
}

When the function executed, i got error message like this enter image description here

I have read any solutions, it's not working, but when the path root using single slash, it's working. So how to convert or replace double slash to single slash in filesystem laravel?



via Chebli Mohamed

Aucun commentaire:

Enregistrer un commentaire