Currently I having problem with Laravel cannot use moveDirectory and copyDirectory however makeDirectory or deleteDirectory works fine, the code as follow:
&
Use the File::copyDirectory()
method.
$success = File::copyDirectory($sourceDir, $destinationDir);
The method will return true if all files and subdirectories are successfully copied.
If the destination directory doesn't exist it will be created. It will be created recursively as needed.
I guess moveDirectory
is not available under Storage
. Try with below code
import file system first
use Illuminate\Filesystem\Filesystem;
after that create a new instance and move directory. Path is relative to index.php I guess.
$file = new Filesystem();
$file->moveDirectory('../storage/app/public/old_folder', '../storage/app/public/new_folder');
Edited
You can bypass instance creation with method injection
public function update(Request $request,Filesystem $file, $id)