Is there a rename method for Laravel 5's Filesystem? I looked in the API and in the documentation, could not find it. I am trying to rename a directory, is there an easier way to do this?
The move() method will work on both files and directories.
Related
I am facing the following issue in the production server (not in local or dev):
production.ERROR: phpFastCache\Exceptions\phpFastCacheDriverException: PLEASE CREATE OR CHMOD /var/www/curator5/vendor/raiym/instagram-php-scraper/src/InstagramScraper/sessions/curatorlive.com/Files - 0777 OR ANY WRITABLE PERMISSION! in /var/www/curator5/vendor/phpfastcache/phpfastcache/src/phpFastCache/Core/PathSeekerTrait.php:110
On the following discussion: https://github.com/PHPSocialNetwork/phpfastcache/issues/441, they suggest to create a folder with absolute path for that library to write to. I was thinking to create a folder in storage/app called cache for that purpose, I know that in storage/framework/cache there is a similar folder for the framework to cache, I am not sure if I should use this folder instead.
My questions:
Where in the Laravel 5.1 directory structure is the best place to
create this folder?
Should I use the storage/framework/cache or
create a new one if so what is the best place to create it?
Reference to the folder cache I would like to create inside storage/app and the stuff the library will create inside that folder, in the following image:
Image
For example, I want to merge two .png files in one .png file, but I don't want to share those parts with user. Currently I am storing files in storage folder, but the problem is that storage folder is with .gitignore file as default. Of course I could allow to push it to git, but I suppose it's not a good idea, because there could be thousands of another files uploaded by the user. Now if I want to continue work from another computer I should move all my parts manually.
So what you could advice to me?
You can store it anywhere you want in your application.
For example, you can make a folder in your projects root called /uploads and then use one of laravel helper functions to specify where to save the file:
Example:
$save_path = base_path('uploads');
You can use the Laravel File Class to make sure the path exists with:
File::makeDirectory($save_path, $mode = 0755, true, true);
You will need to add use File; in the top of the file with all the class includes.
Later, to access said files you can make a View Composer which you can add logic to in order to limit who can view the file.
If you want to protect your files so that nobody can access without permission store all file into storage folder. Don't put your file in public folder.
I'm trying to load a language folder inside a laravel's package called permissionmanager , I know that including files directly inside vendor folder isn't the recommended way, but trying to extend it on the resources/views/vendor folder was unsuccessful.
the problem occurs when i try to upload the folder to the server using filezilla,it's not allowed. because i suppose laravel's vendor folder is protected.
so how can I load that lang file (es/permissionmanager.php) in the right way?
Use the "resources/lang" folder, not "resources/views". So it will be:
resources/lang/vendor/backpack/es/permissionmanager.php
I updated my laravel app from 5.2 to 5.3 then 5.4 (To avoid problems with direct update). The update was successful and my app is working fine. But then I can't find changes in the folder structure. A particular change I will like to see is my routes.php file leaving from root/app/Http/ to root/routes/.
I am wondering if this is normal and how I can modify it to take the new structure thanks in advance!
Well, if you update your app, those changes won't be made automatically. In upgrade guide there are only described changes that are necessary to make your application work.
When we are talking about routes, it's not so important, so you can have them as you had before or if you want you can move them and also rename those files (now there is no routes.php file but web.php, api.php and console.php files).
To move routes into new structure you should compare https://github.com/laravel/laravel/blob/5.2/app/Providers/RouteServiceProvider.php with https://github.com/laravel/laravel/blob/master/app/Providers/RouteServiceProvider.php - so you need to update your RouteServiceProvider file and move files into new locations.
I am working in a E-Commerce Laravel project. In this project, I need to include/require/import files stored in a different server of the E-Commerce. How I can do that? What are the paths I have to include? And what are the files I have to modify?
You really do not want to do that. Even if there is a possibility to include php files from different machine, it's an awful idea. Do not do that.
If you need to get some data from another server, use RESTful API or something like this.