2
votes
<?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

1
Is that controller in the folder ./controllers/http/ and if so, shouldn't the namespace be App\Controllers\Http? - castis
The controller folder is in Http - app/Http/Controllers. Laravel 5 directory structure changes I guess. I haven't used Laravel 4. - Faizuddin Mohammed

1 Answers

2
votes

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

Cheers,