[FEATURE REQUEST] Define names for each route #407

Closed
opened 2026-02-04 19:40:06 +03:00 by OVERLORD · 3 comments
Owner

Originally created by @noxify on GitHub (Aug 16, 2017).

Currently the routes are defined like this:

Route::group(['prefix' => 'books'], function () {
        Route::get('/', 'BookController@index');
});

And inside the views, we have it defined like this:

<a href="{{ baseUrl("/books/") }}">

If I change the prefix to something else, each defined link shows an 404 error.

If we're changing it to:

Route::group(['prefix' => 'books'], function () {
        Route::get('/', 'BookController@index')->name('books.index');
});

We can use inside the view:

<a href="{{ route("books.index") }}">

This allows us, to change the url prefix to whatever we want.

Originally created by @noxify on GitHub (Aug 16, 2017). Currently the routes are defined like this: ``` Route::group(['prefix' => 'books'], function () { Route::get('/', 'BookController@index'); }); ``` And inside the views, we have it defined like this: ``` <a href="{{ baseUrl("/books/") }}"> ``` If I change the prefix to something else, each defined link shows an 404 error. If we're changing it to: ``` Route::group(['prefix' => 'books'], function () { Route::get('/', 'BookController@index')->name('books.index'); }); ``` We can use inside the view: ``` <a href="{{ route("books.index") }}"> ``` This allows us, to change the url prefix to whatever we want.
Author
Owner

@noxify commented on GitHub (Aug 17, 2017):

For the AJAX urls, we can use https://github.com/tightenco/ziggy or something else.

@noxify commented on GitHub (Aug 17, 2017): For the AJAX urls, we can use https://github.com/tightenco/ziggy or something else.
Author
Owner

@ssddanbrown commented on GitHub (Aug 17, 2017):

If I'm honest I'd prefer to not use named routes as it adds another layer of abstraction when looking at the code.

In addition we'd need to override the default name -> URL resolving to work for BookStack instances placed on non root domains.

@ssddanbrown commented on GitHub (Aug 17, 2017): If I'm honest I'd prefer to not use named routes as it adds another layer of abstraction when looking at the code. In addition we'd need to override the default `name -> URL` resolving to work for BookStack instances placed on non root domains.
Author
Owner

@ssddanbrown commented on GitHub (Aug 4, 2018):

Closing as the fundamental goal of this is open under #406, This is more of an implementation detail of that request.

@ssddanbrown commented on GitHub (Aug 4, 2018): Closing as the fundamental goal of this is open under #406, This is more of an implementation detail of that request.
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/BookStack#407