@msslgomez try
'report_upload' => [
'driver' => 'local',
'root' => public_path('reports') ,
],
and run php artisan config:clear
I'm trying to create a new folder inside a public disk but I'm having issues. This is what I have so far
while (Storage::disk('report_upload')->exists($name . '.xlsx')) {
$name .= $counter;
$counter++;
Storage::disk('report_upload')->makeDirectory('Reportes-' . $request->request_time);
}
Excel::store(new SurveyReport($items), $name . '.xlsx',
'report_upload/Reportes-' . $request->request_time);
This is for a Job but they all fail with this error
InvalidArgumentException: Disk [report_upload/Reportes-2021-04-16 13:13:45] does not have a configured driver.
This is my config filesystems.php
'report_upload' => [
'driver' => 'local',
'root' => public_path() . '/reports',
],
What am I doing wrong?
Also side question, this is to download all the files that get created, should I just take everything to a zip file regardless of what gets created and then delete everything? I wanted to create a folder for each time these files have to get created but that's where I'm stuck.
A folder does get created but not by me for the same file every time and I don't know what's up with that.
sorry for the confusion, the tinker command didn't work. But yea the filesystems.php looks like this
'disks' => [
'local' => [
'driver' => 'local',
'root' => storage_path('app'),
],
'public' => [
'driver' => 'local',
'root' => storage_path('app/public'),
'url' => env('APP_URL').'/storage',
'visibility' => 'public',
],
'report_upload' => [
'driver' => 'local',
'root' => public_path('reports'),
],
's3' => [
'driver' => 's3',
'key' => env('AWS_ACCESS_KEY_ID'),
'secret' => env('AWS_SECRET_ACCESS_KEY'),
'region' => env('AWS_DEFAULT_REGION'),
'bucket' => env('AWS_BUCKET'),
'url' => env('AWS_URL'),
],
],
I have it working as I want with the following code
$request_date = date_create(JobRequest::find($this->request_id)->request_time);
$path = public_path('reports/reports_' . date_format($request_date, 'd_m_Y'));
if (!File::exists($path)) {
File::makeDirectory($path, 0755, true);
}
Excel::store(new SurveyReport($items), $name . '.xlsx', 'report_upload');
if (Storage::disk('report_upload')->exists($name . '.xlsx')) {
rename(public_path('reports/' . $name . '.xlsx'),
public_path('reports/reports_' . date_format($request_date, 'd_m_Y') . '/' . $name . '.xlsx'));
}
Thank you for all your help.
Please or to participate in this conversation.