Skip to content

Tag: laravel-routing

Laravel URL Filtering with GET

I am building a simple Laravel routing to display an array when someone goes to http://127.0.0.1:8000/planets But I need to make a filter to check the array on what request has been send on the URL. For example: http://127.0.0.1:8000/planets?planet=mars I need to make sure that if a GET parameter is present, …

Laravel model user custom binding “/users/me/xxx”

I have routes with user binding like So I can use /users/1/posts, /users/5/posts etc, and in controller it’s automatically available thanks to model binding But for current logged user I want to make possible to also use /me/ instead ID, like /users/me/posts Is there a way to make it without defining se…

routes/web route me to another route

My web doesn’t seem to be directing to the correct page. Here is my blade Here is my routes/web and here is my controller For some reason, when I click the a tag with the href {{ route(‘add-new-information’) }} to go to the add page ‘adminviews/addinfo’, instead the page will go …

Laravel 8 redirect web routes

It seems there is an error in my Laravel 8 routes somewhere. My web routes file: When going to /, it is redirected to /en. But when going to /dashboard it isn’t redirected to /dashboard/en but gives an error: As can be seen, not a lot of information given. Anyone knows what to do? Answer Found it: Larav…

Ways to write Laravel routes

Is there a better way to write these routes? It seems I am repeating the same controller in my route files. Answer You can use a resource route, where you specify a subset of actions in the controller. You can also use the –model option when generating a controller with the stubbed out CRUD methods. Res…