Using Laravel 5.4. it's giving me an error of
NotFoundHttpException in RouteCollection.php line 161:
I'm uploading files under storage directory. I can see files in project-root/storage/app/files
Also I have created symlink using php artisan storage:link. When I visit the generated link (http://example.com/storage/files/RcDPA5N6FpTWCnnh2w8bQO85id53oAiCeZgITpwB.png)
though, it gives me not found exception.
Also I'm wondering if I'm referring resource then why route is being called.
That command will generate a symlink to app/storage/public so the files would need to go in app/storage/public/files and then they should be accessible via http://example.com/storage/files/RcDPA5N6FpTWCnnh2w8bQO85id53oAiCeZgITpwB.png.
Related
I'm using laravel 5.6 and using the following code:
return response()->file($pathToFile);
My problem is I cant seem to find what folder pathToFile is pointing to. I tried the public/folder, but that doesn't appear to be it.
Laravel stores files under /storage which is by default hidden to public.
If you want to make them publicly available you need to issue command php artisan storage:link
After that all your files in your /storage directory will be accessible in your http:/domainname/storage via for example asset('storage/yourfile');
I've uploaded an entire Laravel site. The first time everything was working fine.
Now I had an update and did the same thing all over again. Now the URLs are wrong. Whatever route I choose I get an
InvalidArgumentException in FileViewFinder.php line 137:
View [errors.404] not found.
I also see the following:
at FileViewFinder->findInPaths('errors.404', array('C:\xampp\htdocs\myApp\app\resources\views')) in FileViewFinder.php line 79
Which is really incorrect.
If I echo something in routes.php I can see the echo.
Update
The OP has website in shared hosting with-out SSH access to run artisan commands.
php artisan cache:clear
php artisan route:cache
Problem
Route cached: The OP uploaded local project into shared hosting with cached routes. Which caused routes conflict.
Laravel assumes c:\xampp\{project_name} to be local directory while it was different path.
Solution
The solution was to remove bootstrap\cache\ content (Cached routes)
I have this issue with homestead where it can't access any of my views instead it tells me NotFoundHttpException in RouteCollection.php line 145: (this is a new project) . When I try accessing an old laravel project which I made it works perfectly fine but when I create a new project it throws me this error. Now I have also tested it with php artisan serve and try accessing this on localhost:8000 and this works without problems. so why does homestead have problems?
NotFoundHttpException is actually thrown when there was no matching route found.
Seeing how it's working fine using artisan serve I think you should have a look wether the 'app' is setup properly in the Homestead configuration.
You can find more info on that here: https://laravel.com/docs/5.2/homestead#adding-additional-sites
In blade use url() funtion to route
for example
<a href='login'>test</a>
to
<a href='{{url("login")}}'>test</a>
And make sure that mod_rewrite in enable
I got following error on every controller
Fatal error: Class 'CI_Controller' not found in /<path>/system/core/CodeIgniter.php on line 233
The root folder has also its same separate codeigniter system (all ci structure) folder. the site in root in working but when i copy the another ci structure in sub folder i got mentioned fatal error. please help me.
Check your database config in application/config/database.php it's one of the major time consuming error message I faced with CI. Because the error message was simply misleading. So, check the DB config first.
I had a similar problem when trying to run a migration that is within a folder, it appears that my 'git' is with a conflict in the directory separator.
I was trying to run on command line:
$ php index.php tools/migration
fix it temporarily with the command:
$ php index.php tools migration
I have put the following files in
/app/Resources/TwigBundle/views/Exception
error.html.twig, error.json.twig , error403.json.twig, error404.json.twig
But still i am not able to get those templates
I want it for access denied exception
Token does not have the required roles.
403 Forbidden - AccessDeniedHttpException
1 linked Exception:
AccessDeniedException ยป
If i were you i'd customize the error403.html.twig in the following folder app/Resources/TwigBundle/views/Exception/error403.html.twig
I guess you've mistaken the format of this file (json instead of html)
Also, make sure that you've cleared the cache (php app/console ca:cl) and that you are in prod environement.
A more recent update for this. I found that in Symfony 2.8.x, the template you need to override is called exception.html.twig.
I did so by adding the following file in this path.
app/Resources/TwigBundle/views/Exception/exception.html.twig
You can find the original in this folder here:
vendor/symfony/symfony/src/Symfony/Bundle/TwigBundle/Resources/views/Exception