2,265 questions
3
votes
0
answers
101
views
Implicit model binding fails when using {locale} prefix in routes
I'm working on a multilingual Laravel 12 app. All my routes are grouped under a {locale} prefix, like this:
Route::prefix('{locale}')
->group(function () {
Route::get('/activities/{...
0
votes
1
answer
94
views
Laravel route inside prefix not resolving correctly 404 given
I’m running into a routing issue in my Laravel application and could use some help figuring it out.
In one of my views, I have a modal that allows users to search for coupons via a small Alpine.js ...
-1
votes
1
answer
194
views
i want to redirect to home page while page not found (404) in laravel
i have a website made in laravel.
if someone type www.example.com/product.php then it should automatically be redirect to www.example.com
problem: www.example.com/product.php
need solution: www....
2
votes
2
answers
47
views
Route 404 in laravel11. Is there any rule to prioritize route in web.php
My issue is, even if I added route in web.php then also it gives me 404 not found.
My route file as below.
<?php
use Illuminate\Support\Facades\Route;
use App\Http\Controllers\StudentController;
...
0
votes
0
answers
63
views
Laravel Routing Base URL includes extra stuff
I am new to Laravel Routing but I am trying to set up initial routes within my application. I have a route set up like this:
Route::get('/coach/base/athletes-dash', fn () => view('base::athletes-...
0
votes
1
answer
179
views
Method App\Livewire\ListStudents::index does not exist
New to larvel was trying out a video tutorial...and i got stuck in this basic thing... not too sure what i am doing wrong ...
web.php
use App\Livewire\ListStudents;
use Illuminate\Support\Facades\...
0
votes
2
answers
78
views
How to chain model binding with where in route
If I have route like this.
Route::get('/users/{user}/posts/{post}', function (User $user, Post $post) {
return $post;
});
Then If User id 1 has Post id 1,2,3 and User id 2 has Post id 4,5,6.
How ...
2
votes
1
answer
2k
views
Laravel route model binding in laravel 11 doesn’t work for routes in a customized route file
In my laravel 11 app I created a route file named admin.php to put my admin routes there.
I configured admin.php in bootstrap app.php based on laravel’s documentation this way:
return Application::...
0
votes
1
answer
337
views
problem with routes API laravel in cPanel
A few days ago I uploaded my laravel project to my hosting with my test domain, in cPanel.
There I could see that my vue components were not loading, I did not see the data tables, etc..
Searching, I ...
0
votes
0
answers
71
views
Laravel 404 not found error : cannot found a class even though it already been made
I starting to learn php and laravel to make a website. I create a view class named inputdata. From this class, I want to make a route to another view class named KelompokSupir. To connect them, I make ...
1
vote
1
answer
324
views
Laravel routes are not updating on server
When I upload my Laravel application to the server, routes are not being updated. For example, I have added the following simple route, at the very top of the other routes:
Route::get('/test', ...
2
votes
1
answer
320
views
Laravel email verification URL redirect to 404
I want to use a custom template for verification emails being sent by Laravel 11. It generates a verification url, but when I click it, it shows 404 on the browser.
Below is my user model where I ...
-1
votes
2
answers
246
views
How does Laravel return files in the public directory?
I am new to Laravel and can't seem to find the answer to a technical detail of the implementation. Essentially, when I put any given file inside the public directory, for e.g. app.css, and then ...
0
votes
1
answer
443
views
Laravel 11 - Executing php artisan install:api is giving "Symfony\Component\Process\Exception\ProcessStartFailedException"
I set up a new Laravel 11 project and try to install API routes by executing php artisan install:api command.
This results in the below error.
Laravel install api error
OS: Mac OS Sonoma 14.3.1 (23D60)...
1
vote
1
answer
140
views
Laravel: Replacing middleware parameters in nested routes
I have a Route group which applies middlewares to all nested routes. I am passing a parameter to it.
Inside the group, though, I have a specific route for which I want to pass a different parameter. ...
0
votes
0
answers
508
views
Laravel [404]: GET / - No such file or directory
i'm using laravel 8 and php 7.3
The code run fine but suddenly it show
I've tried making new laravel file but when i ctrl + f5 it's still the same
i also tried php artisan cache:clear, php artisan ...
1
vote
0
answers
45
views
Laravel: Missing required parameter for [Route: cicilan] [URI: cicilan/{id}] [Missing parameter: id]
I'm trying to open cicilan page while passing the id where the button is clicked then show the data based on the id. this is the cicilan button
data: 'statusPelunasan',
name: 'statusPelunasan',
render:...
0
votes
2
answers
86
views
Routing issues in Laravel project
I am working on a Laravel project where I have three types of admins, each with their own login pages. Here are the routes:
// Core Admin Routes
Route::get('/core-admin', [CoreAuthController::class, '...
1
vote
1
answer
575
views
Auth Middleware not working properly In Laravel 10
In my Laravel Project i have few routes which i want to protect if the user is not authenticated thats why i make this changes to Authenticate middleware :
namespace App\Http\Middleware;
use ...
1
vote
0
answers
1k
views
CORS policy issue: 'Access-Control-Allow-Origin' header contains multiple values
I'm facing a CORS policy issue in my Laravel application when trying to make a request to an API endpoint from my frontend. The error message I'm receiving is:
Access to XMLHttpRequest at 'https://...
-2
votes
2
answers
304
views
Laravel API DELETE Requests of Resource Controller and Getting 404 Not Found Error (for Second time Delete)
I'm encountering a peculiar issue in my Laravel API setup. I have a resource controller for managing student data, including deletion. When I make a DELETE request to http://127.0.0.1:8000/api/student/...
0
votes
1
answer
82
views
how to display a name instead of an Id in a URL?
I have a route that's look like this /collections/1 and I want it to look like this /collections/name that instance name is stored inside my database and it is unique, I want it to showen in the URL ...
0
votes
1
answer
404
views
Laravel Dynamic Navbar from Database
Changed the source code so it now works properly.
I created a dynamic navigation for the frontend page. However, I had a little problem with it. When I navigate to the page of one of the entries in ...
0
votes
0
answers
79
views
Access single route parameter from Laravel route containing multiple parameters
I have a route defined as:
Route::domain('{subdomain}.' . config('app.domain'))->group(function () {
Route::get('/some-url/{id}', function ($id) {
return $id;
});
});
When defining my ...
0
votes
1
answer
268
views
Laravel 10: forgot yourpassword links jumps back to login form
I am using the Laravel auth package in a Laravel 10 project. The Forgot Password link used to work a few weeks ago. I don't know what changed, but when I click the Forgot Your Password link, it ...
0
votes
1
answer
614
views
Laravel route issue, alwyas use php artisan optimize after create new route
i have laravel issue, after create new route, laravel cant detect that, i always use php artisan:optimize after create new route url. What Should i do to fix this issue ?
I hope that after creating a ...
0
votes
2
answers
473
views
Laravel 8 prefix on route not working when placed and url works with prefix if its not on code
I have a routes folder admin.php, with following intended code
Route::prefix('admin')->group(function(){
Route::get('/new/dashboard',[SuperAdminController::class,'dashboard']);
Route::get('/new/...
0
votes
1
answer
267
views
Custom Request class for validation gives 405 Method Not Allowed Laravel 10
I am trying to store data using store method and using VendorStoreRequest class for validation. However, I am getting : 405 Method Not Allowed error. When I change to normal Illuminate Request it ...
0
votes
1
answer
3k
views
Laravel auth::sanctum middleware not working for API routes
I am getting the error InvalidArgumentException: Auth guard [auth] is not defined. with the below given code.I understood this error is because I have added auth in the guards array of config/sanctum....
4
votes
1
answer
976
views
Laravel route model binding for model with UUID does not instantiate the model
I've run out of ideas, so I thought I'll ask around. Here's my code:
# app/Map/MapServiceProvider.php
class MapServiceProvider extends ServiceProvider
{
/**
* Bootstrap any package services.
...
-1
votes
1
answer
89
views
Laravel - redirect to route with id after successfull ajax
I am trying to figure this out. I have backend in laravel and i am returning id of new created client. How can i use this param in js redirect? This is my best try but i am getting into this url: ...
0
votes
1
answer
126
views
add extra 'admin' prefix in admin routes in laravel 8
I have created some routes in Laravel using Route::methods and also resources but some admin and non-admin routes add extra 'admin' prefix in routes.
So when I am calling the routes it does not work ...
0
votes
1
answer
42
views
Can I get same data using POST rote that I got using GET route
I have two routes in my Web.php,
Route::get('/employees', [ApiController::class, 'employees'])->name('employees');
Route::post('/employeesPost', [ApiController::class, 'employees'])->name('...
-1
votes
1
answer
111
views
Why am I getting get method not supported error(supported method : post) even though I use post method?
I am trying to build a user and client page with laravel I created a page that can be used to create users now I want to create a page just like that when I click those users but I keep on getting ...
0
votes
0
answers
117
views
Use Macroable or allowing somehow to add custom attributes to RouteRegistrar
I'm doing this:
\Illuminate\Routing\Route::macro('description', function (string $description): AppServiceProvider|\Illuminate\Routing\Route {
$this->action['description'] = isset($this-...
0
votes
2
answers
5k
views
Route returning 404 NOT FOUND for /about-us in Laravel. How to resolve it?
PHP Version - 8.2.4
Laravel 10
I am facing an issue with one of the routes in my Laravel application. I have defined a route for the '/about-us' URL, but whenever I try to access it, I get a 404 NOT ...
0
votes
1
answer
203
views
What does to_route('route_name') mean in Laravel?
I saw this in this tutorial:
return to_route('route_name');
Does to_route('route_name') mean the same as redirect()->route('route_name)?
I tried finding an explanation in the Laravel docs, but ...
0
votes
2
answers
1k
views
Automatic Module-Based Route Generation in Laravel Using Directories: Is It a Good Approach?
I have been working on a Laravel project where I needed to organize my codebase using modules. To achieve this, I created separate directories for each module under the app/Modules folder. One ...
0
votes
0
answers
845
views
Laravel Dynamic Route names depends on optional route param
In Laravel 10, I have routes that are structured like the following:
Route::group(['middleware' => ['permission:edit-settings']], function () {
$module_name = 'settings';
$controller_name = ...
0
votes
1
answer
67
views
How to define a route which chooses to right Controller on the fly /{slug}
I am currently facing the challenge, that I have the same route pattern for two Controllers.
To make it easier, let's say we have a BlogController and a PageController. Both controllers have the same ...
0
votes
0
answers
66
views
Laravel correct URL is returning incorrect content
in Laravel, I have made a project to handle supervisors to supervisor their students PG or final year project,
here is a simple explanation of what the project is about,
every use can have many roles, ...
0
votes
0
answers
313
views
Capture domain in Laravel routes file as url variable
I have a problem capturing the domain in the routes file.
When a route is written like this:
Route::domain('mydomain.com')
->get('/', function () {
return "It works";
});
...
0
votes
0
answers
77
views
how to set resource route using controller case by ID and on the controller get the id
without resource, I can use like this is work:
use App/Http/Controller/Aaa/XxxController as AaaXxxController;
use App/Http/Controller/Bbb/XxxController as BbbXxxController;
Route::get( "/aaa"...
0
votes
1
answer
831
views
Laravel: Login doesn't redirect to home
I am having issues logging in using Laravel. Every time a user logs in, it redirects them to the post route (a blank page) instead of home, which is the intended route. Even when I login with the ...
-1
votes
2
answers
342
views
Laravel 5.8: How to add a custom anonymous route to the Laravel's core file
I have a Laravel 5.8 application and I need to add a custom anonymous route to the Laravel's core file which is Router.php and located in this directory:
/vendor/laravel/framework/src/Illuminate/...
-1
votes
2
answers
161
views
What is the faster way to load callback from class in laravel route
1. Route::get('list', [App\Http\Controllers\Driver\DocumentController::class,'list']);
2. Route::get('list', ['Driver\DocumentController@list']);
What is the faster way to load callback from class ...
-2
votes
2
answers
432
views
Laravel Namespace Resource Controller Routing
I was working on a laravel project. The following is the code of my UserController:
<?php
namespace App\Http\Controllers\Backend\Admin\Users;
use App\Models\User;
use Illuminate\Http\Request;
use ...
-1
votes
2
answers
763
views
Missing method in laravel 10 doesn't work?
I'm trying to treat this 404 erro return and I can't do it using the apiResources and Missing method.
For example, I'm doing this:
And whenever it give me a 404 page web error.
Tks!
Route::...
0
votes
1
answer
838
views
Laravel Fortify verification.notice route not defined
I am trying to use Laravel Fortify for authentication. All routes work fine except for email verification.
I have done everything according to docs as far as I understand:
Impemented Illuminate\...
0
votes
2
answers
4k
views
Laravel call internal API from controller using post and passing basic auth authorization to request
I am calling internal API route from controller but unable set headers using laravel 8
$request = Request::create('/api/login/', 'POST',['id' => '1']);
$request->headers->set('Authorization','...