title: Unable to prepare route [api/user] for serialization. Uses Closure
body: <p>I'm writing my project on Laravel. When I optimize the project, I have a problem :</p>
  
  <blockquote>
    <p><strong>Unable to prepare route [api/user] for serialization. Uses Closure.</strong></p>
  </blockquote>
  
  <p>I looked for any closures in web.php, but I didn't find anything</p>
  
  <pre><code>    &lt;?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('/','ReviewsController@main')-&gt;name('main');
  Route::post('/','MailController@verify')-&gt;name('verifyPost');
  
  Route::get('/reviews', 'ReviewsController@index')-&gt;name('reviews');
  Route::post('/reviews','ReviewsController@add')-&gt;name('addReview');
  
  Auth::routes();
  Route::group(['middleware' =&gt; 'admin','prefix' =&gt; 'admin'],function () {
      Route::get('/', 'HomeController@index')-&gt;name('admin');
      Route::get('/reviews', 'Admin\ReviewsController@get')-&gt;name('admin.reviews');
      Route::get('/reviews/accepted/{id}','Admin\ReviewsController@accept')-&gt;where('id','\d+')-&gt;name('admin.accepted');
      Route::delete('/reviews/delete','Admin\ReviewsController@delete')-&gt;name('reviews.delete');
  });
  </code></pre>