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
10
votes
2 answers

How to set the default controller in Laravel?

I'm using the Laravel PHP framework and am wondering about a few things. The default application/routes.php file contains this: Route::get('/', function() { return View::make('home.index'); }); This just outputs the view, but how do I call a…
DisgruntledGoat
  • 70,219
  • 68
  • 205
  • 290
10
votes
3 answers

Laravel debugging 404 routes

Ok, the full routes.php file that I use... I just pasted it here: http://pastebin.com/kaCP3NwK routes.php //The route group for all other requests needs to validate admin, model, and add assets Route::group(array('before' =>…
Alex
  • 7,538
  • 23
  • 84
  • 152
9
votes
2 answers

Laravel 5.1 Routes that have question mark

I'm trying to create a route in Laravel 5.1 that will search the records base on "keyword". I like to include a ? in my url for more readability. The problem is that when I'm including the ? and test the route with postman it returns nothing. But…
Abdullah
  • 603
  • 3
  • 8
  • 19
9
votes
1 answer

Method not allowed when PUT used over AJAX for Laravel resource

I've got this resource in routes.php: Route::resource('items', 'ItemsController', ['before' => 'admin_access']); Trying to reach ItemsContoller@update method through AJAX but it's kicking out a 405 Method not allowed error: var $inputs = $('input',…
eComEvo
  • 11,669
  • 26
  • 89
  • 145
9
votes
1 answer

How to re-route a laravel call internally (without redirect)?

In laravel, a given url is routed to a specific controller method. Inside that method, I want to return the response as if the user has visited a different route. I can do this like so: return App::make('OtherController')->otherMethod(); However,…
Benubird
  • 18,551
  • 27
  • 90
  • 141
9
votes
1 answer

Single route giving a 403 Forbidden error in Laravel 4

I have been trying to figure out why this is happening for the past couple of days with no success. I found some other questions dealing with 403 errors while routing in Laravel but none pertaining to a problem with a single route. Somewhat new to…
Brian
  • 165
  • 1
  • 3
  • 6
8
votes
5 answers

Laravel - regex route match everything but not exactly one or more word

I make a route like Route::get('/{url1}', function ($url1) { return ' url1: '.$url1; }) ->where('url1', '^(?!(string1|string2)$)'); and access url like: - domain/abc not found => incorrect ?? - domain/string1 not found => correct and more, when…
DeLe
  • 2,442
  • 19
  • 88
  • 133
8
votes
5 answers

How Best to Link to a Polymorphic Relation in Laravel

Model A has a polymorphic relation to models X, Y, Z. Relevant fields in A are: poly_id (integer foreign key) poly_type (string App\X, App\Y or App\Z) Given an instance of model A, I can successfully use $a->poly to retrieve the related object of…
Space
  • 2,022
  • 1
  • 19
  • 29
8
votes
5 answers

How to put route in anchor tag in laravel 5.2

I've gone through many of the articles below, which explains generating link from named route, but unable to solve my problem. Tutorial 1 Tutorial 2 Tutorial 3 Following is the defined routes: Route::get('/nitsadmin/dashboard', function () { …
Nitish Kumar
  • 6,054
  • 21
  • 82
  • 148
8
votes
3 answers

Authentication redirects fail

when I login with wrong credentials I got the right response. when I login with the right credentials the login page reload with 302 request but it never redirect to statistics page. when I debug it I found that the code goes to this…
Hesham Watany
  • 300
  • 3
  • 20
8
votes
5 answers

Class 'App\Http\Controllers\Controller' not found - Laravel 5.2

I am new here but I already checked all solutions about my problem here and still didn't fix it. I want to create simple app with tutorial in Laravel 5.2, and I can't make my controller to work. I named my app "test" and here is a…
Ciapss
  • 106
  • 1
  • 2
  • 7
8
votes
3 answers

Laravel 5.1 add Query strings in url

I've declared this route: Route::get('category/{id}{query}{sortOrder}',['as'=>'sorting','uses'=>'CategoryController@searchByField'])->where(['id'=>'[0-9]+','query'=>'price|recent','sortOrder'=>'asc|desc']); I want to get this in url:…
Arnab Rahman
  • 1,003
  • 1
  • 9
  • 15
8
votes
5 answers

Laravel 5 - NotFoundHttpException in RouteCollection.php line 143

I get this error: Sorry, the page you are looking for could not be found. 1/1 NotFoundHttpException in RouteCollection.php line 143: in RouteCollection.php line 143 at RouteCollection->match(object(Request)) in Router.php line 746 at…
Chen Alon
  • 242
  • 2
  • 5
  • 13
8
votes
3 answers

Laravel 5.1 Delete a row from database

I am trying to delete a category by clicking on a button Blade:
vignesh pbs
  • 418
  • 2
  • 5
  • 16
8
votes
6 answers

Redirect www to non-www in Laravel with URL parameters

How can I redirect URL from www.myapp.co to myapp.co ? And also if the URL has other parameter like www.myapp.co/other-parameter will be redirected to myapp.co/other-parameter where the other-parameter can be anything. Sorry for this noob question,…
Port 8080
  • 858
  • 3
  • 12
  • 24