Faizuddin Mohammed
Faizuddin Mohammed

Reputation: 4328

Laravel Controller Error - Class does not exist

<?php 

namespace App\Http\Controllers;

class FormContoller extends Controller
{
  public function add(){
  $item = new App\Item;
  //Some random code with the $item class
  return redirect('success');
  }
}

Here's my Routes.php

Route::post('add','FormController@add');

Also, the controller has the name - "FormController". No errors there, I guess.

But, I get the following error...

ReflectionException in Container.php line 776: Class App\Http\Controllers\FormController does not exist

I'm beginner. Please help out!

Thanks in advance

Upvotes: 2

Views: 5190

Answers (1)

Anders R. Bystrup
Anders R. Bystrup

Reputation: 16090

You've called if FormContoller but in Routes.php it says FormController - with two r's.

Cheers,

Upvotes: 2

Related Questions