0

I have searched and found a similar question that was asked before but it did not solve my problem of composer update and composer dumpautoload did not solve it.

I am creating a CMS based website I have created with a PostsController and a create method.

I return a view and the route is below:

  Route::get('/post/create',[
'uses' => 'PostController@create',
'as' =>  'post.create'

]);]

this is PostsController@create

<?php

namespace App\Http\Controllers;
namespace App\Http\Controllers\PostController;
use Illuminate\Http\Request;
use Illuminate\Http\Controllers;


class PostsController extends Controller
 {
  /**
   * Display a listing of the resource.
   *
   * @return \Illuminate\Http\Response
   */
   public function index()
     {
       //
      }

    /**
     * Show the form for creating a new resource.
     *
     * @return \Illuminate\Http\Response
     */
     public function create()
         {
           return view('admin.posts.create');
             }

Error screenshot at browser

Please don't say this question has been asked before.

Help me! I have checked laracast but the link bellow did not work.

https://laracasts.com/discuss/channels/general-discussion/reflectionexception-class-apphttpcontrollersadminadmincontroller-does-not-exist

1
  • Some punctuation would be nice ;-) Commented Sep 1, 2018 at 8:57

3 Answers 3

1
'uses' => 'PostController@create',

this is Post.

class PostsController extends Controller

this is Posts.

These are must same. Its just letter mistake.

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

Comments

0

You have used wrong route. Edit your route to

Route::get('/posts/create',[
'uses' => 'PostsController@create',
'as' =>  'posts.create'
]);]

Comments

0

There are lot of syntax errors. Follow names with caution.

  1. Remove second namespace line namespace App\Http\Controllers\PostController;// remove this one
  2. Error in class name, should be use Illuminate\Http\Controller;// singular
  3. Route has to follow exact class name 'uses' => 'PostsController@create',//plural

Comments

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.