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');
}
Please don't say this question has been asked before.
Help me! I have checked laracast but the link bellow did not work.
'uses' => 'PostController@create',
this is Post.
class PostsController extends Controller
this is Posts.
These are must same. Its just letter mistake.
You have used wrong route. Edit your route to
Route::get('/posts/create',[
'uses' => 'PostsController@create',
'as' => 'posts.create'
]);]
There are lot of syntax errors. Follow names with caution.
namespace App\\Http\\Controllers\\PostController;// remove this one
use Illuminate\\Http\\Controller;// singular
'uses' => 'PostsController@create',//plural
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.