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
6 answers

Laravel redirect::route is showing a message between page loads

I'm currently developing a web app using Laravel, and the app was working perfectly fine until recently. I had no idea what triggered it but here's a summary of the issue I'm having: Logging in used to work as I have an AccountController that does…
Zhia Chong
  • 51
  • 1
  • 3
5
votes
1 answer

Laravel 4 how check if a route only comes/redirected from another route?

Say i have localhost/public/admin that redirects immediately to localhost/public/user/login. How am I going to get the admin value in user/login?
user2002495
  • 2,126
  • 8
  • 31
  • 61
5
votes
3 answers

How to build a Laravel route that requires a specific URL query parameter?

Let's say I have URLs like this: localhost/admin/users/ <--- Main Admin Users page localhost/admin/users/?data=refresh <---- A typical ajax request made from that page And a simple controller like this: class UsersController extends Controller { …
prograhammer
  • 20,132
  • 13
  • 91
  • 118
5
votes
1 answer

Laravel 4: Two different view pages for a single URI based on auth status

I have recently got into developing with Laravel 4 and I had a question about routes. For '/', I would like to have two different view pages based on the user's auth status. If a user is logged in and is viewing '/', I would like to show them a view…
Kevin Jung
  • 2,973
  • 7
  • 32
  • 35
4
votes
1 answer

Laravel routes, api and web use cases

I am trying to wrap my head around the use cases of web routes and api routes. So far, from what i understand 1) Web routes, are used when we want to return views. 2) Api routes, are used when we want to return json ( Api resource/collection…
Orestis uRic
  • 347
  • 1
  • 6
  • 11
4
votes
2 answers

Laravel Use HTTPS

I have project and I installed SSL certificate on ubuntu server. I have done every solution I found but still getting this message every time I open a page. The requested URL /about was not found on this server. Here is what I have changed to force…
Miss. Nada
  • 321
  • 1
  • 4
  • 14
4
votes
1 answer

Error: Call to a member function storeAs() on string

public function cadastraAutomovelHomeAdd(Request $request) { $file = $request->arquivo; $upload = $request->arquivo->storeAs('products', 'novonomeaffffff.jpg'); exit(); } Form
4
votes
2 answers

Laravel Parameter in every url

I have read almost everything in web and documentation but i can't find solution for my Problem. I have a variable stored in Session , then I want to put this variable in every url generated by route('some-route') . In Session I have sub =…
Malkhazi Dartsmelidze
  • 4,783
  • 4
  • 16
  • 40
4
votes
1 answer

API Route Not Showing in route:list

I made Route in my routes->api, but when I do php artisan route:list, it shows me all routes except this route: Route::apiResources([ 'vh-invoice' => 'API\VhInvoiceController' ]); Even when I remove some routes its shows me the same route:list,…
4
votes
1 answer

Extending Laravel Router API

I'm trying to extend the Laravel 5.6 router class to add some handy methods to register routes. I have created a class that extends the Illuminate\Routing\Router class like this: Namespace App\Overrides; use Illuminate\Routing\Router as…
Pelmered
  • 2,727
  • 21
  • 22
4
votes
1 answer

Route::redirect with wildcard in Laravel 5.5+

The new Route::redirect introduced in Laravel 5.5 is practical, but does it allow {any} wildcard? Here is what I used to do in Laravel 5.4 Route::get('slug', function () { return redirect('new-slug', 301); }); In Laravel 5.5, I can do the…
pimarc
  • 3,621
  • 9
  • 42
  • 70
4
votes
3 answers

Laravel - Get Route Parameter in a Model

I'm using Laravel 5.5 I have a 'Post' Model. In that model I want to use a Route Parameter (say userId).. I have this id in Post Controller. public function getPosts($userId) { $posts = Post::latest()->paginate(8); return…
4
votes
3 answers

Laravel prefix routes redirect

I have admin prefix where url/admin/dashboard is my dashboard view. What I need is to redirect users to url above if they type only url/admin . This is what I have: Route::prefix('admin')->group(function () { Route::get('dashboard',…
mafortis
  • 6,750
  • 23
  • 130
  • 288
4
votes
3 answers

Remove csrf token only for single method - Laravel

I am using paytabs payment gateway api. In that api, a redirect url have to given, so that once the transaction is completed, the page will redirect automatically to your given redirect url. The url was a GET url but since the response of the api…
nerdyDev
  • 376
  • 3
  • 15
4
votes
2 answers

Get an API URL by route name in Laravel 5.5

Is there a way to specify the prefix when getting a route URL by its name in Laravel 5.5? For example, In routes/web.php Route::resource('users', 'UserController', ['only' => 'index', 'create', 'edit']); In routes/api.php…
Erin
  • 5,315
  • 2
  • 20
  • 36