目标类别[App \ Http \ Controllers \ EventsController]不存在

时间:2019-11-10 22:32:16

标签: laravel routing

在我的管理页面上设置一个创建按钮,按此按钮可以打开创建页面

<a href="{{route('create')}}">Add Event</a>

我要创建的控制器功能是打开的

<?php

namespace App\Http\Controllers;
use App\Http\Controllers\Controller;

use Illuminate\Http\Request;

use App\Event;

class EventsContoller 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('layouts.create');
    }

    /**
     * Store a newly created resource in storage.
     *
     * @param  \Illuminate\Http\Request  $request
     * @return \Illuminate\Http\Response
     */
    public function store(Request $request)
    {
        //
    }

    /**
     * Display the specified resource.
     *
     * @param  int  $id
     * @return \Illuminate\Http\Response
     */
    public function show($id)
    {
        //
    }

    /**
     * Show the form for editing the specified resource.
     *
     * @param  int  $id
     * @return \Illuminate\Http\Response
     */
    public function edit($id)
    {
        //
    }

    /**
     * Update the specified resource in storage.
     *
     * @param  \Illuminate\Http\Request  $request
     * @param  int  $id
     * @return \Illuminate\Http\Response
     */
    public function update(Request $request, $id)
    {
        //
    }

    /**
     * Remove the specified resource from storage.
     *
     * @param  int  $id
     * @return \Illuminate\Http\Response
     */
    public function destroy($id)
    {
        //
    }
}

我的web.php路线是

Route::get('/admin/create', 'EventsController@create')->name('create');

我尝试了 composer dumpautoload ,但是它不起作用

1 个答案:

答案 0 :(得分:0)

因此您的控制器似乎不完整。.您是如何生成它的?您使用过mipmap-吗?

文件应如下所示:

php artisan make:controller EventsController