tengo un problema al realizar el comando php artisan route:cache, hago este comando porque no me coje unos parametros del .env (no se si esto afecta) y a raiz de esto he decidido lanzar todo tipo de cache.
Los archivos de rutas api.php y web.php los tengo tal como esto
api.php
<?php
use Illuminate\Http\Request;
/*
|--------------------------------------------------------------------------
| API Routes
|--------------------------------------------------------------------------
|
| Here is where you can register API routes for your application. These
| routes are loaded by the RouteServiceProvider within a group which
| is assigned the "api" middleware group. Enjoy building your API!
|
*/
/**
Route::middleware('auth:api')->get('/user', function (Request $request) {
return $request->user();
});
**/
Route::middleware(['checkIp'])->group(function () {
Route::get('coches', 'Api\CochesController@index')->name('api.taller-servicios.index');
Route::get('coches/{id}', 'Api\CochesController@show')->name('api.taller-servicios.show');
Route::put('coches/{id}', 'Api\CochesController@update')->name('api.taller-servicios.update');
});
Archivo web.php
<?php
/*
|--------------------------------------------------------------------------
| Web Routes
|--------------------------------------------------------------------------
|
| Here is where you can register web routes for your application. These
| routes are loaded by the RouteServiceProvider within a group which
| contains the "web" middleware group. Now create something great!
|
*/
Route::get('/', function () {
return view('welcome');
})->name('welcome')
->middleware(\App\Http\Middleware\CheckAuth::class);
Route::get('/login', function () {
return view('welcome');
})->name('login')
->middleware(\App\Http\Middleware\CheckAuth::class);
Route::get('/signin', 'AuthController@signin')->name('signin');
Route::get('/authorize', 'AuthController@gettoken');
Route::get('/logout', 'AuthController@logout');
La respuesta que tengo al ejecutar el comando es esta.
C:\xampp\htdocs\site_pruebas>php artisan route:cache
Route cache cleared!
LogicException : Unable to prepare route [/] for serialization. Uses Closure.
at C:\xampp\htdocs\site_pruebas\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()
C:\xampp\htdocs\site_pruebas\vendor\laravel\framework\src\Illuminate\Foundation\Console\RouteCacheCommand.php:62
2 Illuminate\Foundation\Console\RouteCacheCommand::handle()
C:\xampp\htdocs\site_pruebas\vendor\laravel\framework\src\Illuminate\Container\BoundMethod.php:32
Please use the argument -v to see more details.
C:\xampp\htdocs\site_pruebas>