Laravel Storage:Link not working for custom folder structure - php

My Laravel folder structure is
Laravel
|
|--site
|--files
Here, sites is my public folder. And rest of the folders go to files folder.
Now, when I run the command php artisan storage:link, it says
System cannot find the path specified
And obviously, the link is not working.
What am I missing here?

you have to update your helper functions
public_path()
storage_path()
according you your new directory structure
don't change the core may be you can create a new helper file and include in the composer.json.

Related

Change Laravel storage path to outside of instalation directory

I have installed Laravel on /var/www/html/website but now I want to change storage path to /mnt/volume
So for doing this, I added this code in bootstrap/app.php
app()->useStoragePath('/mnt/volume/public/');
Now upload works fine, but after upload, a file new extra directory created like:
/mnt/volume/public/mnt/volume/mnt/volume/public/bookimages/77iF2Gdr7pKXXLRLovgIpfcKBxY1h7CRqKjc35SC.jpeg
which as you can see Laravel created mnt/volume/mnt/volume directory again.
Laravel Framework 5.5.44
Now, How can I solve this issue?
Create a custom disk in your filesystem.php config file with the root property set to your custom path instead

Issue with key (cipher error) when changing laravel folder structure

I am changing laravel 5.3 folder structure. What I exactly do is basically move all the content from public folder to root folder, and then all the other files besides public folder to the new created folder - project. Then I update the require paths in index.php, and when I try to run the project via XAMPP, I'm getting this error.
I am pretty sure that the key is set correctly, because I haven't changed anything else but the folder structure and paths, and the project worked before this folder structure change. It seems to me that program can't locate the .env file.
Try running
php artisan config:clear
and
php artisan key:generate
I followed this post

Laravel 5.2 After moving content from "public" to root i got many wrong paths with bower_components

I've completed my Laravel project and now I want to get out /public from my URL address.
I did it like this:
Put all contents of root (except public folder) to the new folder called local.
I've moved all the contents of public to root and deleted public folder.
I've edited index.php file and updated paths to:
require __DIR__.'/local/bootstrap/autoload.php';
$app = require_once __DIR__.'/local/bootstrap/app.php';
Now the problem is that I get bower_components errors and I don't know where or how update this:
Here are console errors.
Since I do not have public folder it should look like this:
vvfoodD/admin/bower_components/...
I've also added folder structure of my project, maybe it will help. It is like in my Laravel project root I have another project called admin.
Here is my folder structure
So my question is where and how can I update this?
It seems to me that you have wrong paths set up in your view. Can you try removing /public from the paths to bower in your view?

Routes file not properly loaded

I have just installed a new installation of Laravel using composer as per the laravel docs. The documentation refers to the app/routes.php file which is used to map routes to controllers or closed functions. First, there was no app/routes.php file so I created one. Now the routes I've copied from the laravel documentation aren't being found when accessing via the browser. In fact the app/routes.php file isn't even being found by the application as I have put a die statement in there and nothing. It has nothing to do with .htaccess. I am using the default .htaccess and redirects are working. I thought maybe it has something to do with the composer.json autoload array so I have tested that and nothing. Not a jot. Either I'm being thick or there is something fundamental which isn't being explained in the docs. I'm running the latest version of laravel. Any ideas?
Laravel changed the folder structure with its latest release (which is version 5):
In 4.2: app/routes.php
In 5.0: app/Http/routes.php
There's also a few things you need to do in order for a Laravel Project to work. First (and this is the method I use) create a symbolic link to your project's public folder:
ln -s /path/to/webroot/example_app/public /path/to/webroot/example
Next, change the permissions on your storage folder:
chmod 777 -R storage
You should now be able to access localhost/example and the Laravel 5 welcome page should show up. Usually I call my project example_app and create a link to a folder called example, so I can easily access it via localhost/example
In Laravel 5, the routes file is located elsewhere: app/Http/routes.php.
Basically I did chmod 777 on the storage and vendor files and it started working

app structure in Laravel 4 and class does not exist

I have structured my app as the following
note: "MyCMS" is a folder inside the "app" directory of laravel root directory
http://paste.laravel.com/POt
the problem is that whenever i try to access the route "admin/users"
i get the following error
Class \MyCMS\Admin\UserController does not exist
any ideas where the problem might be ?
In your UserController.php, it should be
namespace MyCMS\Admin\Controllers; not namespace MyCMS\Admin;
And a side note, I don't think you can just call $this->package('MyCMS/Admin'); when it's in your app directory. If you look into laravel's source code for the package method, it's actually guessing the path for your "package" and going two levels up to get the resources. It's a very specific file structure.
sometime we face this issue then we should use <?php instead of <? in UserController.php
Then use composer du or composer dump-autoload
The reason for your issues is quite simple. Packages don't go in the app directory of Laravel.
If you want to create a package, do so with the following command:
php artisan workbench vendor/package --resources
This will then create a workbench folder in your Laravel installation, where a pre-defined directory structure will be at the ready for your newly created package.
/src
/Vendor
/Package
PackageServiceProvider.php
/config
/lang
/migrations
/views
/tests
/public
You may then register the provider by adding it to the providers array in the app/config/app.php file. After a composer dump-autoload your package should be ready to use in your app.
See this section in Laravel's documentation on how to create packages properly.

Categories