【发布时间】:2019-09-21 15:50:25
【问题描述】:
当我执行返回的代码时:
找不到类“app\Nota”
我尝试在控制器中使用app\Notas::all(); 而不是app\Nota::all();,但没有奏效。我也尝试过use app\Notas; 而不是app\Nota;,但对我没有用。
我的模特:
<?php
namespace App;
use Illuminate\Database\Eloquent\Model;
class Nota extends Model
{
//
}
我的控制器:
<?php
namespace App\Http\Controllers;
use Illuminate\Http\Request;
use app\Nota;
class productoController extends Controller
{
public function show($id){
$notas = app\Nota::all();
print_r($notas);
die;
}
}
可能是什么问题?
【问题讨论】:
-
在你的控制器中应该是
use App\Nota;而不是use app\Nota; -
$notas = Nota::all();
标签: php laravel eloquent model