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
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 have defined a route in web.php
Route::get('/dashboard/create-sub-project/{id}', 'SubProjectController#create')->name('sub-project.create')->middleware('auth');
and adding it a view.php
<a href='{{ route('sub-project.create', $project->id) }}'>Create new project</a>
but it keeps on throwing an error
Route [sub-project.create] not defined. (View:
view.blade.php)
Other routes I have defined works fine.
php artisan route:list
The problem was, I have added two routes on the same name with the different intention that caused the issue. Removed duplicate fixed the issue in Web.php
In Your command prompt run
php artisan route:list
the Clear route cache by running
php artisan route:clear
then you will be good to go.
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
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.
I did look at the other Laravel Route questions, but nothing seems to work for me.
I am trying Laravel 4. I ran the command:
php artisan controller:make PhotoController
to create my controller. Then I added a route in my routes.php file as such:
Route::resource('photo', 'PhotoController');
When I go to localhost/photo, I see 404 Not Found.
Any ideas? I can see the root and /index.php, they both say "Hello World", so I know something is working.
You might need to run
composer dumpautoload
from the command line, so laravel knows the controller is there.
you can also try this:
php artisan dump-autoload