T
T
The-TS2020-10-02 19:33:14
Laravel
The-TS, 2020-10-02 19:33:14

What to do about this Laravel error?

I'm quite new to Laravel , I came across this problem while learning.

routes/web.php:

<?php

use Illuminate\Support\Facades\Route;

/*
|--------------------------------------------------------------------------
| Web Routes
|--------------------------------------------------------------------------
|
| Here is where you can register web routes for your application. These
| routes are loaded by the RouteServiceProvider within a group which
| contains the "web" middleware group. Now create something great!
|
*/

Route::get('/', function () {
    return view('home');
})->name('home');

Route::get('/about', function () {
    return view('about');
})->name('about');

Route::get('/contact', function () {
    return view('contact');
})->name('contact');

Route::post('/contact/submit', '[email protected]')->name('contact-form');

Yes, I created the class using artisan
How to fix it?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
S
Sanes, 2020-10-02
@Pyhon3x

Routing has changed in Laravel 8.
use App\Http\Controllers\ContactController;

Route::post('/contact/submit', [ContactController::class, 'submit'])->name('contact-form');

No namespace, full path.
Route::post('/contact/submit', [\App\Http\Controllers\ContactController::class, 'submit'])->name('contact-form');

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question