title: Class App\Http\Controllers\PostController does not exist
body: <p>Let me just start by saying "I know this question gets asked a lot." believe me when i say nothing has worked for me.</p>
  
  <p>I have created a controller called <code>PostController</code>. This is a controller for my blog. When I navigate to my blog i get the following error <code>Class App\Http\Controllers\PostController does not exist</code> even though it does exist. The controller is called <code>PostController.php</code>. Here is what the route looks like <code>Route::get('blog','PostController@index');</code>. I have read that running some <code>composer</code> commands will help but none of them have helped me. <code>composer dumpautoload</code> as well as <code>composer update</code>. Am i missing some step here? Anyone run into a similar problem? Please let me know if additional information is needed.</p>
  
  <p><strong>EDIT</strong>
  Here are the namespaces at the top.</p>
  
  <pre><code>use App\Http\Controllers;
  use App\Posts;
  use App\User;
  use App\Http\Controllers\Controller;
  use App\Http\Requests\PostFormRequest;
  use Illuminate\Http\Request;
  </code></pre>
  
  <p>Here is the whole Controller.</p>
  
  <pre><code>&lt;?php 
  use App\Http\Controllers;
  use App\Posts;
  use App\User;
  use App\Http\Controllers\Controller;
  use App\Http\Requests\PostFormRequest;
  use Illuminate\Http\Request;
  
  
  
  class PostController extends Controller {
  
  /**
   * Display a listing of the resource.
   *
   * @return Response
   */
      public function index()
      {
        //fetch 5 posts from database which are active and latest
        $posts = Posts::where('active',1)-&gt;orderBy('created_at','desc')-&gt;paginate(5);
        //page heading
        $title = 'Latest Posts';
        //return home.blade.php template from resources/views folder
        return view('blog/home')-&gt;withPosts($posts)-&gt;withTitle($title);
      }
  
  
  /**
   * Show the form for creating a new resource.
   *
   * @return Response
   */
      public function create(Request $request)
      {
        // if user can post i.e. user is admin or author
        if($request-&gt;user()-&gt;can_post())
        {
          return view('blog.create');
        }    
        else 
        {
          return redirect('blog');
        }
      }
  
  
  /**
   * Store a newly created resource in storage.
   *
   * @return Response
   */
      public function store(PostFormRequest $request)
      {
        $post = new Posts();
        $post-&gt;title = $request-&gt;get('title');
        $post-&gt;body = $request-&gt;get('body');
        $post-&gt;slug = str_slug($post-&gt;title);
        $post-&gt;author_id = $request-&gt;user()-&gt;id;
        if($request-&gt;has('save'))
        {
          $post-&gt;active = 0;
          $message = 'Post saved successfully';            
        }            
        else 
        {
          $post-&gt;active = 1;
          $message = 'Post published successfully';
        }
        $post-&gt;save();
        return redirect('edit/'.$post-&gt;slug)-&gt;withMessage($message);
      }
  
  
  /**
   * Display the specified resource.
   *
   * @param  int  $id
   * @return Response
   */
      public function show($slug)
      {
        $post = Posts::where('slug',$slug)-&gt;first();
        if(!$post)
        {
           return redirect('/')-&gt;withErrors('requested page not found');
        }
        $comments = $post-&gt;comments;
        return view('posts.show')-&gt;withPost($post)-&gt;withComments($comments);
      }
  
  
  /**
   * Show the form for editing the specified resource.
   *
   * @param  int  $id
   * @return Response
   */
      public function edit(Request $request,$slug)
      {
        $post = Posts::where('slug',$slug)-&gt;first();
        if($post &amp;&amp; ($request-&gt;user()-&gt;id == $post-&gt;author_id || $request-&gt;user()-&gt;is_admin())){
            return view('posts.edit')-&gt;with('post',$post);
        }
        return redirect('blog')-&gt;withErrors('you have not sufficient permissions');
      }
  
  
  /**
   * Update the specified resource in storage.
   *
   * @param  int  $id
   * @return Response
   */
      public function update(Request $request)
      {
        //
        $post_id = $request-&gt;input('post_id');
        $post = Posts::find($post_id);
        if($post &amp;&amp; ($post-&gt;author_id == $request-&gt;user()-&gt;id || $request-&gt;user()-&gt;is_admin()))
        {
          $title = $request-&gt;input('title');
          $slug = str_slug($title);
          $duplicate = Posts::where('slug',$slug)-&gt;first();
          if($duplicate)
          {
            if($duplicate-&gt;id != $post_id)
            {
              return redirect('edit/'.$post-&gt;slug)-&gt;withErrors('Title already exists.')-&gt;withInput();
            }
            else 
            {
              $post-&gt;slug = $slug;
            }
          }
          $post-&gt;title = $title;
          $post-&gt;body = $request-&gt;input('body');
          if($request-&gt;has('save'))
          {
            $post-&gt;active = 0;
            $message = 'Post saved successfully';
            $landing = 'edit/'.$post-&gt;slug;
          }            
          else {
            $post-&gt;active = 1;
            $message = 'Post updated successfully';
            $landing = $post-&gt;slug;
          }
          $post-&gt;save();
               return redirect($landing)-&gt;withMessage($message);
        }
        else
        {
          return redirect('blog')-&gt;withErrors('you have not sufficient permissions');
        }
      }
  
  
  /**
   * Remove the specified resource from storage.
   *
   * @param  int  $id
   * @return Response
   */
      public function destroy(Request $request, $id)
      {
        //
        $post = Posts::find($id);
        if($post &amp;&amp; ($post-&gt;author_id == $request-&gt;user()-&gt;id || $request-&gt;user()-&gt;is_admin()))
        {
          $post-&gt;delete();
          $data['message'] = 'Post deleted Successfully';
        }
        else 
        {
          $data['errors'] = 'Invalid Operation. You have not sufficient permissions';
        }
        return redirect('blog')-&gt;with($data);
      }
  
  
  }
  </code></pre>
  
  <p>Thanks.</p>