I'm trying to create icons for sites created in the past using laravel intervention, and this line is to make directories to save the icons for each site using this seeder
I'm trying to run a seeder, in the seeder I call a function from my controller, but when the function tries to make a directory it's stopping works.
this is a part of my seeder
$route = $this->templateController->resizeImage($logo, $placeName, $domain);
and when I do a debug with xdebug, this line of code call to the function correctly.
my controller:
public function resizeImage($logo, $placeName, $domain)
{
$img = \Image::make($logo)->resize(32, 32, function ($constraint) {
$constraint->aspectRatio();
$constraint->upsize();
});
$route = 'img' . DIRECTORY_SEPARATOR . $domain . DIRECTORY_SEPARATOR . 'favicon.png';
if (File::exists($route)) {
$img->save(public_path($route));
} else {
$newRoute = File::makeDirectory('img' . DIRECTORY_SEPARATOR . $domain);
$img->save(public_path($route));
}
return $route;
}
All works correctly, but when I debugging this line
$newRoute = File::makeDirectory('img' . DIRECTORY_SEPARATOR . $domain);
I get this error in the artisan console
mkdir(): No such file or directory
at D:\Programas\laragon\www\google-places-ranking\vendor\laravel\framework\src\Illuminate\Filesystem\Filesystem.php:581 577▕ if ($force) { 578▕ return @mkdir($path, $mode, $recursive); 579▕ } 580▕ ➜ 581▕ return mkdir($path, $mode, $recursive); 582▕ } 583▕ 584▕ /** 585▕ * Move a directory.
1
D:\Programas\laragon\www\google-places-ranking\vendor\laravel\framework\src\Illuminate\Filesystem\Filesystem.php:581 mkdir("img\testing")2
D:\Programas\laragon\www\google-places-ranking\vendor\laravel\framework\src\Illuminate\Support\Facades\Facade.php:261 Illuminate\Filesystem\Filesystem::makeDirectory("img\testing")
Note: This function works correctly when I use this controller with a form
makefile
tag in this question? - MadScientist