I have a GET request to:
/review/response
The route is present in the php artisan route:list with other two working routes to that controller, so controller is fine.
Here is a part of my controller code:
But when accessing to that route, this is the response I get:
I already run composer du and php artisan route:clear
All other methods in that controller are working, any idea?
Your namespace should be following :
namespace App\Http\Controllers
I believe your route should be like:
Route::get('review/response', ['as' => 'review.action', 'uses' => 'App\Http\Controllers\Admin\ReviewController#action']);
The problem is in your namespace. Give it a try.
Related
I am working in a laravel project running version 5.6.39. When I try to run a command php artisan route:list, it generates an error saying "ReflectionException : Class App\Http\Controllers\Auth\AuthController does not exist".
routes\web.php looks like...
How can I resolve this issue? Please help.
Thank You.
The reason behind this issue is when you run php artisan route:list laravel reads all routes from routes folder and executes every controller that exists in them and if laravel couldn't find the controller or there is an error in them laravel throws an exception
so with that in mind it means you either removed App\Http\Controllers\Auth\AuthController or you moved it to another folder but didn't update the AuthController namespace and also the namespace in web.php so in your case you need to fix namespace in web.php and also in controller until they match
I created a new controller with resources using the PHP artisan command:
php artisan make:controller AdminCategoriesController --resource
The file gets added to the controller folder but when I visit my route list with I see no route about it:
php artisan route:list
Here my routes list:
How can I add the categories to my routing list?
This error is showing because you did not give instance of Resource Controller in web.php file.
Route::resource('route','AdminCategoriesController ');
When you did this , route list will show.
I failed to add the route resource in my routes.php
Route::resource('/admin/categories', 'AdminCategoriesController');
Everything works now.
If you are using api then use this syntax to generate controller
php artisan make:controller API/PhotoController --api
No matter what I try, the route /authenticate/{code} returns a NotFoundHttpException.
My route in routes.php:
Route::get('/authenticate/{code}', ['as' => 'authenticate', 'uses' => 'FrontendController#getAuthenticate']);
When I am calling the route:
URL::route('authenticate', $code)
On my local machine it runs it just fine, but on my production server, it takes me to a NotFoundHttpException page.
It does site inside of the web middleware group.
I have tried (with no success):
resetting the github repo on the server (fresh install)
composer update
php artisan cache:clear
php artisan view:clear
php artisan route:clear
php artisan config:clear
composer dump-autoload
changing the route from authenticate to authenticate-email
What could it be? Every other route on the site works, it is just this one that doesnt.
The only thing I can think to advise is switching from using the URL Facade to using the built in helper function $url = route('authenticate', ['code' => $code]); I only say this because I can't seem to find in the docs how you hint at URI parameters when using URL::route() :)
I also ran into this issue. I deleted the route, then copy another working route and changed the route name and parameters with the one. And It Worked
I don't know if you solved this but I just had exactly the same problem, nothing I did would make the route work. It was a really simple route: Route::get('/search', ['middleware' => 'shop_session','uses' => 'Cinder\StoreController#viewProducts']);
Did all the things you did. In the end I moved the route to the top of my routes file, ran php artisan route:cache and it worked.
Not a great answer and I've got no idea why it worked but it did. Maybe worth a try?
php artisan make:controller was working but now produces this error?
[Symfony\Component\Debug\Exception\FatalErrorException]
Class 'Rout' not found
Seems like you have a typo in your routes file, located at app/Http/routes.php.
You have Rout there instead of Route.
You are using Rout instead of Route
It must be a spelling mistake please check
I am new on laravel, and I am making some test and following a tutorial. The matter is that I don´t know what I did two days ago that I got any defaults controllers (maybe only one... I don´t remember, for example: HomeController). I removed the project and create a new one... but now these defaults controllers don´t exit. And my routes.php on app/http folder is like this:
Route::get('/', function () {
return view('welcome');
});
ONLY THIS!!!
I remember that the routes.php file of the first laravel test project had something like: get("home")... or get("login"), etc...
Do I need to install them via artisan or something?
When installing Laravel, i. e. with this command composer create-project --prefer-dist laravel/laravel blog, there is no app/Http/Controller/HomeController.php generated.
You only get one route in your routes.php. That's it!
What you could do, of course, is:
Create a class HomeController.php in app/Htpp/Controllers - use php artisan make:controller HomeController
Change the route in your routes.php to utilize the new HomeController
Route::get('/', 'HomeController#index');
Another thing you may did in the past was running php artisan make:auth to initialize basic controller ands views to get a scaffold for logins/registers of users.
Maybe authentication? It will create some views and routes.
https://laravel.com/docs/5.2/authentication#authentication-quickstart
The command php artisan make:auth if you are using 5.2.*
no you don't if you want to create a controller just tphp artisan make:controller HomeController and a controller will be created for you :)