Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.

Knumskull's avatar

[4.3] Route cache weird behavior

Hello there,

I have a weird issue with route caching on 4.3. When the app isn't using route caching (using route:clear), I don't have any issue generating any URLs in my template, but as soon as I enable route caching I get "Route [routename] not define" errors.

EDIT 1: It's WIP, so I'm running the app using the PHP's builtin webserv.

For example:

Route [forums.show] not defined. (View: /home/anon/www-dev/yafs/resources/views/categories/quick_view.blade.php) (View: /home/anon/www-dev/yafs/resources/views/categories/quick_view.blade.php) (View: /home/anon/www-dev/yafs/resources/views/categories/quick_view.blade.php)

Here is my blade template (which is included elsewhere):

<div class="panel panel-default">
  <div class="panel-heading">{{ $category->name }}</div>

  <ul class="list-group">
      @foreach($category->forums as $forum)
          <li class="list-group-item">
              <a href="{{ route('forums.show', [$category->id, $forum->id]) }}">{{$forum->name}}</a>
              @if($forum->description != null)
                <p class="help-block">{{$forum->description}}</p>
              @endif
          </li>
      @endforeach
  </ul>
</div>

And here is my route file:

Route::controller('auth', 'Auth\AuthController');
Route::controller('password', 'Auth\RemindersController');

Route::get('/', 'CategoriesController@index');
Route::get('category', 'CategoriesController@index');
Route::get('category/{id}', ['as' => 'categories.show', 'uses' => 'CategoriesController@show']);


Route::get('category/{category}/forum/{forum}', ['as' => 'forums.show', 'uses' => 'ForumsController@show']);

Route::get('category/{category}/forum/{forum}/topic/create', ['as' => 'topics.create', 'uses' => 'TopicsController@create']);
Route::get('category/{category}/forum/{forum}/topic/{topic}', ['as' => 'topics.show', 'uses' => 'TopicsController@show']);
Route::post('category/{category}/forum/{forum}/topic', ['as' => 'topics.store', 'uses' => 'TopicsController@store']);

Route::get('category/{category}/forum/{forum}/topic/{topic}/edit', ['as' => 'topics.store', 'uses' => 'TopicsController@store']);
Route::put('category/{category}/forum/{forum}/topic/{topic}', ['as' => 'topics.store', 'uses' => 'TopicsController@update']);

Route::get('category/{category}/forum/{forum}/topic/{topic}/post/create', ['as' => 'posts.create', 'uses' => 'PostsController@create']);
Route::post('category/{category}/forum/{forum}/topic/{topic}/post/store', ['as' => 'posts.store', 'uses' => 'PostsController@store']);
Route::delete('category/{category}/forum/{forum}/topic/{topic}/post/{post}', ['as' => 'posts.delete', 'uses' => 'PostsController@delete']);
Route::put('category/{category}/forum/{forum}/topic/{topic}/post/{post}', ['as' => 'posts.update', 'uses' => 'PostsController@update']);
Route::get('category/{category}/forum/{forum}/topic/{topic}/post/{post}/rawContent', ['as' => 'posts.raw-content', 'uses' => 'PostsController@rawContent']);
0 likes
1 reply

Please or to participate in this conversation.