2

I've been stuck in a weird problem for a couple of days. All my web application routes are working fine except one. Its has a 404 not found issue. So I checked:

  1. My Routes list. It exists.
|        | GET|HEAD      | dashboard/profile/create                                                      | profile.create                   | App\Http\Controllers\Dashboard\ProfileController@create                                            | web
  1. URI in Routes list & Request URL in search box matches. Request URL: http://localhost/CMSsk/CMS/public/dashboard/profile/create

  2. Checked my blade Layout. No Problems.

<a href="{{ route('profile.create') }}" class="nav-link"><i class="fas fa-briefcase fa-2x mr-2"></i>Add Credentials</a>
  1. Cheked Controller. It exists.
public function create()
    {
        $user       = Auth::user();
        return view('Dashboard.Profile.profile-create',compact('user'));
    }
  1. Cheked Apache2 Rewrite module (Enabled) & Override ALL.

enter image description here

  1. Used PHPUnit & Chrome Browser devtools to check networks,console,Apllication Cookies,storage. Can't find any issues other than 404.

  2. Used PHPUnit testing and XDebug,dd() to trace problem. The Code doesn't reach Controller method.

  3. Checked ALL possible Stack Overflow issues. Did not solve the problem.

  4. Cleared browser Cache.

  5. Did:

php artisan route:cache

Q: What are other possible issues that I might not have checked to solve this simple yet complicated issue?

Note: I referenced the form Page from another page which has a Social Media Sharing 3rd party Plugin Installed(AddThis). Hence I tried other form pages & other links from there and it works. So I'm confused why Only one page has issue(I thought the Plugin may have effect).

Saif Kamal
  • 67
  • 1
  • 11
  • Check for resources with name of ```profile```, do you have such? – Mohammad.Kaab May 24 '20 at 06:19
  • Yes. I have traditional resource routes for CRUD & 19 other routes with 'profile' prefix which I kept in a separate Route Group. None of the Routes match with each other on URI and route name. – Saif Kamal May 24 '20 at 07:35

1 Answers1

0

Update:

I fixed the Solution but I wanted to share how I did just so that anyone who stumbles upon this scenario finds some help.So here it goes:

Solution:

I created a Route group first which had the prefix named profile. It had 19 routes. Immediately after that I Created a Resource Route which had it's name prefix. So the two Identical names had a conflict for which I was not getting the page.

How I figured out:

I almost ran out of all possible solutions. So I started Manually testing the routes just to figure out if there's a pattern developing. I know it's not the most effective way but I wanted to figure out a pattern that's why I did it. After testing the Route group prefix named profile I figured out that all routes inside this group are NOT working from where I called it. Then I tested Routes outside that group from that specific blade view and it was working. So I changed the name of the Resource Route just to make it distinct from the Route group prefix. And it worked!

Saif Kamal
  • 67
  • 1
  • 11