framework: Laravel 6.3 Action Facade\Ignition\Http\Controllers\ShareReportController not defined
Hi,
I am developing a website using Laravel (v6.3.0), I downloaded a fresh version using composer.
When I run php artisan route:cache
I get
LogicException : Unable to prepare route … for serialization. Uses Closure.
After some searches I found a solution: I removed the closures from api.xml
/*
Route::middleware('auth:api')->get('/user', function (Request $request) {
return $request->user();
});
*/
and web.xml
/*
Route::get('/', function () {
return view('welcome');
});*/
Route::get('/', 'PageController@GetHome');
Now the error disappeared but I get weird behavior. I am running in debug mode, but when there is an error in the code(like undefined method) Laravel shows
Action Facade\Ignition\Http\Controllers\ShareReportController not defined
while trying to view the page instead of the actual error.
When I un-comment the closure (from web.xml or api.xml) Laravel shows the error correctly but it shows also
Unable to prepare route … for serialization. Uses Closure
if I try php artisan route:cache
This happens only with the current version (Laravel v6.3.0) previousely I have worked with Laravel 5.6 and Laravel 6.0.3 and I used to solve the closures error the same way (by removing them) and this ShareReportController not defined never appeared.
Is this a bug? Should I open an issue for it?
See the following screen for the full stack
About this issue
- Original URL
- State: closed
- Created 5 years ago
- Comments: 16 (5 by maintainers)
First see if the migrations have ran with
php artisan migrate
Try this if that doesn’t workphp artisan cache:clear && php artisan route:clear
did it for me.delete all the php files inside this folder and run again:
\bootstrap\cache
Still throws this error after downgrading to 1.11.1 as suggested and clearing cache and routes. (fresh install of Laravel)
It looks like there is an issue open on the relevant repository as well (https://github.com/facade/ignition/issues/202).
Doing
php artisan migrate
can helpThis happened to me when I was moving files into new directories to better organize my code. Anyways, once I did that i got this error. The fix was a combination of notflip’s recommendation as well as editing your controllers and views to properly reflect the changed files’ paths. For example, let’s say you have an items page (items available in a store)… if you move that items directory into a new empty store directory, you would want to change the ItemsController. So in ItemsController, for the index method, you would have
You would need to change it to:
And, inside your view, if you have any @include statements, you would need to change those as well. So,
would now be
After these changes you need to run notflips’ recommendation:
Hope this helps!
As a workaround:
It should show the actual error in the code.