NotFoundHttpException in RouteCollection.php (line 179) dont fun - laravel

I have a problem in laravel, I have developed a system that worked correctly the routes, but now it does not work any route all give me the same result error.
Esta mi archivo app.blade.php
<li>
<a href={{url('home')}} class="dropdown-toggle">
<i class="fa fa-dashboard"></i>
<span class="hidden-xs">Panel</span>
</a>
</li>
This is my web.php file
Auth::routes();
Route::get('/', function () {
return view('home');
});
Route::get('/home', 'PruebaController#index')->name('home');
this is my Controller file
namespace App\Http\Controllers;
use Illuminate\Http\Request;
class PruebaController extends Controller
{
public function index()
{
return view('home');
}
}
php artisan route:list
I have reviewed everything but I do not find the problem, everything seems to be correct, what I did was to clone the project have something to do.

Dou yo have view->home.blade.php?

Since you mentioned that you have cloned the project, I think its got to do with cache.
Try
php artisan cache:clear
php artisan config:cache

I followed the error to the file RouteColletion.php in the function matchAgainstRoutes when I print the $ request, the last variables
Request {#38 ▼
...
pathInfo: "/ gesis / public / home"
requestUri: "/ gesis / public / home"
baseUrl: ""
basePath: ""
format: "html"
}
I leave empty I think that's why but I do not know why I leave these variables empty.

I corrected it thanks to all, the problem was the simple truth but I could not see the directive APP_NAME = geSis of the file .env changed the uppercase S by the small one so it did not encintrace the route.
I thanked them for their time and I received a lot of comments.

Related

Laravel 404 not found when passing parameter with route()

Hello I have instructors table, and every instructor have name column and I have a page to show events and every event has instructor name and I need to go to the instructor profile page when clicking on the instructor name in the events page so I made this
<a href="{{ route('instructor.profile', ['name' => $event->instructor]) }}" class="a-reset">
<h5 class="color-primary fw-bold">{{ $event->instructor }}</h5>
</a>
web.php
Route::get('/instructor/{name}', 'App\Http\Controllers\InstructorController#profile')->name('instructor.profile');
InstructorController
public function profile($name) {
$instructor = Instructor::where('name', '=', $name)->first();
return view('instructor-profile', compact('instructor'));
}
But it gives me 404 Not Found error page
Make sure it returns value $event->instructor
Make sure the address is correct instructor-profile
by this command rtisan route:list open route list, make sure it is there /instructor/{name} route.
if everything is correct run this command
php artisan route:clear
php artisan config:cache

Laravel route returning error 404 when attempt is made to pass value to controller function

I have a button in my blade like this
#can('customer_show')
<a class = "btn btn-primary" href = "{{ route('admin.loan-applications.showCustView', $loanApplication->user_id) }}">
View Applicant
</a>
#endcan
And this is the route:
Route::get('loan-applications/{loan_application}/showCustView', 'loanApplicationsController#showCust')->name('loan-applications.showCustView');
And in my controller, i did:
public function showCust(LoanApplication $loanApplication)
{
$customerInformation = customerInfoModel::where('Cust_id', $loanApplication->user_id));
return view('admin.loanApplictions.showCustView', compact(['customerInformation', 'loanApplication']));
}
What i am trying to do is fetch the row from the database attached to customerInfoModel where the the Cust_id field equals the loanApplication->user_id of the loan being viewed currently in the blade above. When the button "view Applicant" is hit, i get an error 404 page. Why is that so?
Check it out the route list using this command
php artisan route:list
//this command will show all the routes in your application
If your route not listed on that route list checkout for routes with same Url on your route manually on routes file.
if you found change the url & use this command to clear cache
php artisan optimize:clear
i have found the comment of you on last answer.
check out for route model binding . i think you have to add
a
public function showCust( $loanApplicationCustId)
{
$customerInformation = customerInfoModel::where('Cust_id', $loanApplicationCustId))->first();
return view('admin.loanApplictions.showCustView', compact(['customerInformation', 'loanApplication']));
}
It should be like this .. i hope it works for you......
else share your project git repo link
I think it should be like following:
#can('customer_show')
<a class = "btn btn-primary" href = "{{ route('loan-applications.showCustView', $loanApplication->user_id) }}">
View Applicant
</a>
#endcan
try that

Route not found even though It's defined

This is the error that I get rolled out
(View: Route [user.profile] not defined. (View: D:\Programi\XAMPP\htdocs\crushapp\resources\views\layouts\base.blade.php)
But my route is clearly defined here:
use App\Http\Livewire\User\ProfileComponent;
Route::middleware(['auth:sanctum','verified'])->group(function()
{
Route::get('/user/profile',ProfileComponent::class)->name('user.profile');
});
The error comes from the layout, namely:
<span><i class="fa fa-user-circle-o" aria-hidden="true"></i> {{ Auth::user()->name }}  ‎‎‏‏‎ ‎‎‏‏</span>
Any ideas what could it be?
UPDATE: Any new route I try defining under user won't work...
first you are missing a function name in your route
also run php artisan route:clear
Route::get('/user/profile',ProfileComponent::class, 'index')->name('user.profile')

Route keep asking for parameter even if not set to receive any

I'm new to laravel and I'm having trouble with one of my web routes...
I grouped some routes with the auth middleware
Route::middleware(['auth:web'])->group(function ($router) {
Route::get('/news', [NewsController::class, 'news'])->name('news');
Route::get('/profile/{user_id}', [ProfileController::class, 'profile'])->name('profile');
Route::get('/marketplace', [MarketplaceController::class, 'marketplace'])->name('marketplace');
});
Before this issue, I have set a user_id parameter for the news route and then removed it the next day, now the news route keeps returning error saying it needs user_id.
here's my controller:
<?php
namespace App\Http\Controllers;
class NewsController extends Controller
{
public function news() {
return view('modules.news.news');
}
}
and since im using laravel-vue mix, my modules.news.news view looks like this:
#section('content')
<newsfeed inline-template>
<div>
...
...
</div>
</newsfeed>
#endsection
I've checked the web route, the controller, the blade, and I really can't see anything that requiring the news route to receive a parameter.
can someone point out where I went wrong?
Your route file might be cached, try running php artisan route:clear and see if this fixes the issue.

Laravel 5.8 controller Index function returning blank page

I have created a new resource controller but my index function returns a blank page without any error.
Here is my route:
Route::group(['middleware'=>'admin'], function (){
Route::resource('admin/users', 'AdminUsersController');
Route::resource('admin/posts', 'AdminPostsController');
Route::resource('admin/comments', 'PostCommentsController');
Route::resource('admin/categories', 'AdminCategoriesController');
Route::resource('admin/comment/replies', 'CommentsRepliesController');
Route::resource('admin/products', 'AdminProductsController');
Route::resource('admin/contactus', 'ContactController');
Route::resource('admin', 'AdminController');
Route::get('admin/products/sold',['as'=>'sold', 'uses'=>'AdminProductsController#sold']);
Route::resource('admin/faqs', 'AdminFaqController');
});
My Controller:
<?php
namespace App\Http\Controllers;
use Illuminate\Http\Request;
class AdminFaqController extends Controller
{
/**
* Display a listing of the resource.
*
* #return \Illuminate\Http\Response
*/
public function index()
{
//
return view('admin.faqs.index');
}
My index.blade file:
#extends('layouts.admin')
#section('title', 'Know and your Brand')
#section('content')
<h2>Faqs</h2>
#endsection
I have not been able to figure out what causes the problem, please help
In your command pro. simply type php artisan route:list you can see all of your routs URL paths.
In your case I think you should use / before admin like-
Route::resource('/admin/faqs', 'AdminController');
As #Harshith said..
The reason behind getting blank pages is because Route::resource will create some route with wildcards. We can explain this using by giving an example /admin/{admin} which will map to show method on the controller. So when you make a get request to /admin/faqs it will be mapped to this show method instead of your /admin/faqs.
The reason for not getting any errors is your show method does not have any code yet. Hence, a blank response.
Try using,
Route::resource('/admin/homepage/faqs', 'AdminFaqController');
i suggest you to use html submit bouton to submit and blank
use this:
<button type="submit" formtarget="_blank">Submit to a new window</button>

Resources