When trying to reference a function in my controller, I get the following error. It's missing the "/angular/" in the path. How can I update the root path to include the angular directory?
Remove the / at the beginning of wherever you are trying to call your function, placing ./ might also work.
Related
so i've beein struggling with an old laravel project from 2018 that i can't seen to run. The probem is that the project i splittedinto two folders not a classic laravel one, there's an other one named "httpdocs" and the index.php is there, so i managed to install everything and running the migrations, but noti can't run the website ? idk why it said:
Warning: require(C:\xampp\htdocs\httpdocs/../daddyshop_app/vendor/autoload.php): failed to open stream: No such file or directory in C:\xampp\htdocs\httpdocs\index.php on line 24
the autoload.php file exists
I think this part is wired, see / and \ on the require:
require(C:\xampp\htdocs\httpdocs/../daddyshop_app/vendor/autoload.php)
Maybe you are setting wrongly the folder structure, or in the index.php file, you are searching in the wrong path.
For example, try checking paths are correct:
Maybe /../../laravel-app or ../.. or /../laravel-app.
You get the point, make sure paths are correct.
I have a file in path:
app/public/template/templateeSkillsMatrix_Config.docx
and when i use:
return response()->download(storage_path('app/public/template/eSkillsMatrix_Config.docx'));
It is working, but when i use :
return Storage::download(storage_path('app/public/template/eSkillsMatrix_Config.docx'));
It show an error:
File not found at path: E:/project/agl/nav/New folder/DKMH/storage/app/public/template/eSkillsMatrix_Config.docx
I dont know why.
I read laravel docs , but i dont understand what is parameter of it.
Please help!
Just like #apokryfos's comment ,Storage::download(..) will automatically use the base storage path so i dont need call storage_path method. I need to call it the following:
return Storage::download('public\template\eSkillsMatrix_Config.docx');
in this line, i removed storage_path method and delete app/ in path.
and it is working for me!
I’m creating a deployment configuration for Laravel project.
On my hosting public/ folder must be moved to another place.
Obviously, since that, I need to change path to the autoload.php and app.php in index.php.
However, I’d like to add and use a parameter which would tell where these files reside. Something like this:
require __DIR__ . '/../' . env('DEP_EXT_FOLDER') . 'vendor/autoload.php';
I think, the most proper place for such a parameter is .env file.
However, I’ve got an error:
Call to undefined function env()
You can't use the env() function before loading the autoloader.
if you absolutely want to use your .env file, you will have to use native php preg_match() for finding your key and using the value after that :)
I am using TypiCMS Laravel here : github.com/TypiCMS/Base and I am facing the following problem:
I created a new module named "News" by executing command: composer require typicms/news. I also added providers in config/app.php, have publish views and migrations and migrated the database too.
The only problem I am facing is that whenever the url I given, it redirects me to the root directory of my project, that is, http://localhost/mywebsite/public/
Even, if I give invalid route like localhost/mywebsite/public/foobar, instead of showing me error, it again redirects to the root directory.
I have checked the .htaccess and routes.php file and there is not modifications.
Regards:
Adnan
TypiCMS cannot be installed in a subfolder, the root of your site must be http://localhost.
can any one pls tell me how to delete an image file and directory in yii
I have tried unlink but its not working.(the path is correct but its not deleting) but getting the error No such file or directory
unlink(Yii::app()->request->baseUrl.'/uploads/'.$model->file_id.'/'.$fileModel->file_name.$fileModel->extension);
and I also need to delete a directory in yii framework.the path is
correct but its not deleting
rmdir(Yii::app()->request->baseUrl.'/uploads/'.$model->file_id);
This is not working either, but getting the error No such file or directory.
Try:
unlink(getcwd().'/uploads/'.$model->file_id.'/'.$fileModel->file_name.$fileModel->extension);
getcwd() gets the current working directory. The docs for it are here
Instead of
Yii::app()->request->baseUrl
Try
Yii::app()->basePath
I have never used Yii's earlier versions.
For Yii2: unlink(Yii::$app->basePath.'/directory_path/'.$filename);
we can use this as well
unlink($file->getFullPath());