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

2
  • Is that controller in the folder ./controllers/http/ and if so, shouldn't the namespace be App\Controllers\Http? Commented Feb 19, 2015 at 19:02
  • The controller folder is in Http - app/Http/Controllers. Laravel 5 directory structure changes I guess. I haven't used Laravel 4. Commented Feb 19, 2015 at 19:04

1 Answer 1

2

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

Cheers,

Sign up to request clarification or add additional context in comments.

1 Comment

Ouch.. absolutely! Thanks a lot. Was so frustrated.. Thanks a lot!

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.