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

Laravel resource route with slashes in uri

In laravel 5.4 what is the best way to declare a resource route with slashes in the uri section? For example in my routes/web.php I have: Route::resource('/admin/settings', 'SettingController'); But if I have also this: Route::resource('/settings',…
tioschi
  • 389
  • 1
  • 3
  • 11
3
votes
2 answers

How to return multiple views in one function in laravel for same route

it is quite difficult to explain my question. I hope you will be able understand it. For my project I have a master layout which contains the header and yield of content. master.blade.php @include('partials.header')
Omi kabira
  • 168
  • 1
  • 2
  • 12
3
votes
3 answers

Missing required parameters for route in Laravel

in my laravel application whenever i go to this route: /admin or admin/users I get the following error message but the the other routes work like admin/users/create or admin/users/edit: Missing required parameters for [Route: admin.users.edit]…
steven
  • 191
  • 2
  • 4
  • 12
3
votes
1 answer

Hashtag in URL in Laravel 5

I have a search input for customers. The customers have an address, and some of the addresses contain the number sign, for example #51 Scout Fuentebella. I included address in my search. My route: Route::get('customer/search/{input}',…
Al bassam
  • 225
  • 1
  • 4
  • 16
3
votes
5 answers

Getting "Class 'app\Http\Controllers\Controller' not found" in Laravel 5.1

I'm quite new to Laravel and when I am going through a tutorial when I encountered this error. This is my code in 'testController.php'.
TheShark
  • 420
  • 3
  • 6
  • 17
3
votes
3 answers

Why I obtain this exception when I try to handle an AJAX request with a Laravel controller method?

I am absolutely new in PHP and Laravel and I have the following problem. From my view I perform an AJAX POST request via JQuery, by this code: jQuery.ajax({ url: '/doSearch', type: 'POST', dataType: 'json', //data: $form.serialize(), …
AndreaNobili
  • 40,955
  • 107
  • 324
  • 596
3
votes
1 answer

Default controller key

I have a laravel route like below : Route::group(['namespace' => 'Aggregate\Customer\Controller\v1_0','middleware' => 'jwt.auth', 'prefix' => 'api/v1.0/{lang}'], function () { Route::put('customer/{id}', 'CustomerController@update_customer'); …
bitcodr
  • 1,395
  • 5
  • 21
  • 44
3
votes
1 answer

Laravel authenticated dynamic subdomain routing

I'm trying to get authenticated subdomain routing working for some specific variable subdomains: app.example.com staging.app.example.com testing.app.example.com These should be guarded by the auth middleware. They all essentially reference…
eComEvo
  • 11,669
  • 26
  • 89
  • 145
3
votes
1 answer

more than one guard in route

I use laravel framework I want to use more than one guard in my route like : Route::group([ 'middleware' => 'jwt.auth', 'guard' => ['biker','customer','operator']], function () {} I have a script in AuthServiceProvider.php like below in boot…
bitcodr
  • 1,395
  • 5
  • 21
  • 44
3
votes
1 answer

Get laravel current route group in middleware

Is there a way to get the parent route group of current route in Laravel middlewares? public function handle($request, Closure $next, $guard = null) { // here I mean }
Omid
  • 4,575
  • 9
  • 43
  • 74
3
votes
5 answers

Proper way to pass a hard-coded value from route to controller (Laravel)?

I have a PagesController with one action: view. This action accepts a page argument. What I want to achieve: Have a routes example.com/about and example.com/foobar. When one of this routes is triggered, pass a value predefined in routes file to…
user1327
  • 938
  • 3
  • 10
  • 28
3
votes
1 answer

How to get the current id of model from another controller?

I'm trying to get the id of my model using different controller so I can sync this to my pivot table. I can get the id of my Model using this. class DocumentController extends Controller { //READ public function readDocuments($id) { //Find the…
Francisunoxx
  • 1,440
  • 3
  • 22
  • 45
3
votes
2 answers

Laravel 5.2 High cpu with long routes

I've setup a ubuntu 14.04 with php 5.5 and apache 2.4. I installed a fresh laravel 5.2. No database connections in the project. I then when to app/Http/routes.php and edited to: Route::get('/', function () { return…
3
votes
1 answer

How can I set a catch all route as the very last route in Laravel

I'm building a basic CMS with SEO slugs, so I want a catch all at the end of my routes to get the slug. So at the end of my routes file I added: Route::get('/{page?}', ['as' => 'Page', 'middleware' => 'web', 'uses' =>…
Styphon
  • 10,304
  • 9
  • 52
  • 86
3
votes
1 answer

How to create a catch all url in Laravel 5

I am trying to create a catchall url that starts with the prefix "angular". How do I do this? I tried the following but does not work: Route::group(['prefix' => 'angular'], function () { Route::get( '{catchall}', function () { return…
Yahya Uddin
  • 26,997
  • 35
  • 140
  • 231