0

I cannot bind the "contact" route to the "contact" method which is existing in the "TestController.php" controller

enter image description here

Peppermintology
  • 9,343
  • 3
  • 27
  • 51

3 Answers3

1

You don't need to include the file extension when you define routes, so your route should be:

Route::get('/contact','TestController@contact');

Then make sure you have a controller with that name in your controller directory:

app/Http/Controllers/TestController.php

namespace App\Http\Controllers

class TestController extends Controller
{
    public function contact()
    {
        // your code
    }
}

You can see a working demo here.

Peppermintology
  • 9,343
  • 3
  • 27
  • 51
0

I usually find running php artisan route:clear will solve these issues sometimes.

damask
  • 529
  • 4
  • 17
0

Run Command php artisan optimize will solve issue

mohammad
  • 11
  • 1