Questions tagged [laravel-routing]

Routing in Laravel Framework's MVC implementation. Laravel is a free, open source PHP web application framework, and it is released under the MIT license.

laravel-routing is a tag suitable for any questions regarding routing in Laravel's MVC implementation, url handling, or any other matter affecting or affected by routing in Laravel.

2207 questions
5
votes
4 answers

Alias for a route with a fixed parameter value

I have this route: Route::get('/MyModel/{id}', 'MyController@show'); The method show() accepts a parameter called id and I want to setup an alias for /MyModel/1 so it's accesible from /MyCustomURL. I already tried a few combinations,…
Camilo
  • 6,504
  • 4
  • 39
  • 60
5
votes
2 answers

disable CSRF middleware based on environment in Laravel

In my application I want to disable CSRF when running on my laptop APP_ENV=local and on development too APP_ENV=dev. Can't get my head throguh how to do it in either routes.php or the web middleware. here's my routes.php Route::group(['middleware'…
Anadi Misra
  • 1,925
  • 4
  • 39
  • 68
5
votes
1 answer

Vue router server configuration for history mode on nginx does not work

I read the following note from vue router documentation Note: when using the history mode, the server needs to be properly configured so that a user directly visiting a deep link on your site doesn't get a 404. So, I try to configure my nginx…
Set Kyar Wa Lar
  • 4,488
  • 4
  • 30
  • 57
5
votes
2 answers

Passing "\" and "/" in variable via Laravel Route

First off, apologies if this is a bad question/practice. I'm very new to Laravel, so I'm still getting to grips with it. I'm attempting to pass a variable that contains forward slashes (/) and backwards slashes () in a Laravel 5 route and I'm having…
tombraider
  • 1,127
  • 1
  • 11
  • 19
5
votes
1 answer

Laravel get url on string

can you help me? if in laravel we want to get a variable in url so in route we must wrote like this: Route::get('myweb/article/{article_id}','Controller/ArticleController@show'); it will generate like this www.myweb.com/article/1 and in controller…
5
votes
1 answer

How do I get a list of routes from a module/directory in Laravel 5?

I have 3 modules in app folder such as: User Module , Role Module and Permission Module. Also I have different route.php file in each and every module. Now I need to get a route list from User Module. I got a complete list from all modules using…
S.Reza
  • 345
  • 4
  • 18
5
votes
3 answers

Laravel route redirect without closure for route cache

I have this code on my routes.php file that do a redirect. Though the problem is that whenever I ran php artisan route:cache command, it gives me an error of Unable to prepare route [article/{params}] for serialization. Uses Closure. I know this…
basagabi
  • 4,900
  • 6
  • 38
  • 84
5
votes
3 answers

How to use angular js routing with laravel/lumen routing?

I am working on web application developed on laravel (latest version 5.*).I did a lot of search but not find exact solution for,how to use angular js routing with laravel routing. Suppose urls like : /viewItem/2 /editItem/5 etc,any urls having…
Aniket Muruskar
  • 267
  • 3
  • 9
5
votes
1 answer

Routing is not working laravel 5?

I have just installed fresh laravel 5.1, only root page is showing that Route::get('/', function () { return view('welcome'); }); It's working perfectly but rather than any other route not working like: Route::get('user', function () { …
5
votes
1 answer

Laravel routes with an optional sub-path

I'm trying to create a Route in routes.php that can handle optional unlimited sub-paths. Route::get('/path/{url}', function($url){ echo $url; }); The url's can be the following : /path/part1 /path/part1/part2 /path/part1/part2/part3 etc. But…
Dylan
  • 9,129
  • 20
  • 96
  • 153
5
votes
2 answers

Laravel 5 routing using prefix

Hi I'm building a Laravel 5 project that is to be deployed in a subfolder on a server inside a wordpress application(I don't know why but clients are clients), then I need to prefix all the routes from the application with a prefix like "/es", now…
asolenzal
  • 500
  • 7
  • 23
5
votes
2 answers

Programmatically add exception from CSRF check from Laravel package

The Problem in a Nutshell I'm looking for a way to remove VerifyCsrfToken from the global middleware pipeline from within a package without the user having to modify App\Http\Middleware\VerifyCsrfToken. Is this possible? The Use Case I'm developing…
morphatic
  • 7,677
  • 4
  • 47
  • 61
5
votes
1 answer

Laravel Group inside Group Middleware

I'm having a bit of a problem by using a middleware inside a group that has a middleware itself like the following code: Route::group(['prefix' => '{lang?}','middleware'=>'language'], function() { Route::get('/',…
Diogo Mendonça
  • 903
  • 2
  • 12
  • 29
5
votes
2 answers

How can I do variable/wildcard routes in Laravel?

I am using Laravel 5 and need to do a wildcard route, sending the user to different controllers based on the URL type, pulled in from the database. I need to check the URL slug in the database, and then load the relevant controller/method based on…
Mike
  • 8,767
  • 8
  • 49
  • 103
5
votes
1 answer

Laravel 5.1 Wildcard Route

I'm creating a CMS that allows the user to define categories. Categories can either have additional categories under it or pages. How can I create a route in Laravel that will support a potentially unlimited number of URI segments? I've tried the…
Jacob Haug
  • 509
  • 1
  • 9
  • 18