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
4
votes
5 answers

Laravel - multiple resource routes to single controller with argument

Can we have a single controller for multiple routes, and get the parameter? Currently, I have these routes: Route::resource('/customers', 'CustomerController'); Route::resource('/agents', 'AgentController'); And a CustomerController and a…
MJ Khan
  • 1,696
  • 3
  • 21
  • 36
4
votes
4 answers

Laravel URLs not working in subfolder

I've finished my laravel project and played it in a subfolder on my domain. https://example.com/swap So the above is the root of my directory and when I go there, I do get the index. But now every link I press, I'm redirected to the root of my…
Niknok
  • 51
  • 2
  • 4
4
votes
7 answers

Class App\Http\Controllers\StudentController does not exist in Laravel 5

I am building a module called Student in Laravel. I use the routes.php file inside the Student folder to write routes realted to student module.. When I use just Route::get('/list', function () { return view('welcome');}); program working fine…
4
votes
1 answer

Subdomains and Auth with laravel

I am created a project which has multiple different sections all stored within a subdomain for example: core.sample.com map.sample.com character.sample.com I want the user to only be able to login at: sample.com and see a page to select which…
4
votes
2 answers

Customizing route model binding key

I'm calling a route with a variable appended to it's end, like this: Route::get('/user/{user}', 'UserController@listUser'); That points to a controller with a method like so: public function listUser(User $user){ dd($user); } That's working…
Bruno García
  • 177
  • 11
4
votes
2 answers

How to remove route prefix from route actions in Laravel

I am creating localization in Laravel 5.3 application. It must follow such requirements: If route path contains locale prefix, locale should be set according to this prefix If there's no route prefix, it should be set to English. For instance: A)…
4
votes
4 answers

How to use variables in routes in laravel?

I'm trying to build a application in laravel 5.3 in which I get the variable from request method and then trying to pass that variable in a redirect to the routes. I want to use this variable in my view so that I can be able to display the value of…
Nitish Kumar
  • 6,054
  • 21
  • 82
  • 148
4
votes
0 answers

How I can use Laravel Passport Auth without Vue Component

I have installed Passport Auth in Laravel 5.3 using this documentation https://laravel.com/docs/master/passport but I have followed the steps before "Frontend Quickstart" heading now I have a API route: Route::get('/user', function (Request…
okconfused
  • 3,567
  • 4
  • 25
  • 38
4
votes
1 answer

What does Route::model mean in Laravel?

Can any one explain these lines ? How it works? public function boot() { parent::boot(); Route::model('user', App\User::class); } Next, define a route that contains a {user} parameter: $router->get('profile/{user}', function(App\User…
4
votes
3 answers

Accessing Route URL Parameter in Middleware in Laravel 5.3

I am having a hard time accessing the Route URL Parameter in Middleware after updating from Laravel 5.1 to Laravel 5.3. Here is my route file: Route::group(['middleware' => ['app.access']], function() { Route::resource('apps/{apps}/houses',…
Neel
  • 9,352
  • 23
  • 87
  • 128
4
votes
3 answers

Define Laravel 5 route inside subfolder and display it via controller

I have Laravel 5.2.45 app. I have controller structure like this: App Http Controllers Admin AdminController.php inside AdminController.php I have namespace App\Http\Controllers\Admin; use…
KondukterCRO
  • 543
  • 2
  • 16
  • 31
4
votes
1 answer

How to configure & run multiple websites with respective databases with single Laravel code instance

I have a scenario that I want to implement in Laravel. I have already implemented this kind of approach in custom PHP. But this time, I want to shift all websites to a framework (Laravel). I have multiple domains for different regions implemented…
Zahoor
  • 43
  • 4
4
votes
4 answers

Laravel Middleware / Route Groups

I'm fairly new to Laravel, so this question may obvious to some. In the case of running checks per HTTP request, for example User Authentication. Is there a better, more efficient or simple correct way to run these checks. From my initial research…
scottevans93
  • 1,119
  • 1
  • 9
  • 25
4
votes
1 answer

Laravel5:Redirect::to() outside link NotFoundHttpException in RouteCollection.php

I'm developing a Laravel 5 app, I have this route Route::get('/go','UrlController@index'); and in this UrlController.php,I have this index method public function index(){ return Redirect::to('www.google.com',302); } when I test this url…
C.ryudo
  • 65
  • 3
4
votes
1 answer

How do I use the / (index) route twice for both logged in and logged out?

I'm working on a Laravel project. The project has a public (non authenticated section of the site) and an authenticated section (admin). I am attempting to use the / route to display a public homepage view, and then when authenticated I'd like the…