LogicException : Unable to prepare route [api/user] for serialization. Uses Closure. at /var/www/html/dev_laravel/vendor/laravel/framework/src/Illuminate/Routing/Route.php:917 913| */ 914| public function prepareForSerialization() 915| { 916| if ($this->action['uses'] instanceof Closure) { > 917| throw new LogicException("Unable to prepare route [{$this->uri}] for serialization. Uses Closure."); 918| } 919| 920| $this->compileRoute(); 921| Exception trace: 1 Illuminate\Routing\Route::prepareForSerialization() /var/www/html/dev_laravel/vendor/laravel/framework/src/Illuminate/Foundation/Console/RouteCacheCommand.php:62 2 Illuminate\Foundation\Console\RouteCacheCommand::handle() /var/www/html/dev_laravel/vendor/laravel/framework/src/Illuminate/Container/BoundMethod.php:32
When i trying to run the laravel command
php artisan route:cache
I try to find out the solution but not get the correct solution. https://github.com/laravel/framework/issues/22034
Is this laravel bug still or fixed the bug?
I have the code on web.php file
Route::get('/', function () {
return view('welcome');
});
Route::resource('photos', 'PhotoController@index');
I'm Using Laravel 5.8. Just installed and migrated database. I'm beginner for laravel.
Can anyone let me know the correct solution?
Thanks in advance