Laravel 5.2 Class'App \ authors'未找到

时间:2017-05-21 17:07:56

标签: laravel frameworks

错误是:

  

AuthorsController.php第28行:Class中的FatalErrorException   'app \ authors'找不到

第28行:

<?php

namespace App\Http\Controllers;
use App\authors;

use App\Http\Requests;
use Illuminate\Http\Request;

class AuthorsController extends Controller
{
    /**
     * Create a new controller instance.
     *
     * @return void
     */
    public function __construct()
    {
        $this->middleware('auth');
    }

    /**
     * Show the application dashboard.
     *
     * @return \Illuminate\Http\Response
     */
    public function show()
    {
        $authors = authors::all();  LINE 28
        return view('authors', ['authors'=> $authors]);
    }
}

作者类:

<?php

namespace App;
use App;

use Illuminate\Database\Eloquent\Model;

class authors extends Model
{
    protected $table = 'authors';
}

我不知道错误在哪里......我是Laravel的新手。

1 个答案:

答案 0 :(得分:1)

尝试App \ Author;

检查拼写错误。希望你得到修复