大家好,当我尝试将数据插入到工作表画面时,我是Laravel的新手,现在浏览器投掷(1/1)FatalErrorException Class 'Painting' not found in web.php
(第15行)
希望得到你的帮助。谢谢!
这是web.php
Route::get('/', function () {
$painting = new Painting; //line 15
$painting->title = 'Do No Wronge';
$painting->artist = 'D. DoRight';
$painting->year = 2017;
$painting->save();
return view('welcome');
});
以下是app文件夹中的Painting.php
<?php
namespace App;
class Painting extends Eloquent
{
}
?>
即使FatalErrorException in routes.php line 22: Class 'Painting' not found没有为我正在使用的版本
提供正确的答案答案 0 :(得分:0)
已修改的文件[工作解决方案]
这是 web.php
<?php
use App\Painting;
Route::get('/', function () {
$painting = new Painting; //line 15
$painting->title = 'Do No Wronge';
$painting->artist = 'D. DoRight';
$painting->year = 2017;
$painting->save();
return view('welcome');
});
以下是app文件夹中的 Painting.php
<?php
namespace App;
use Illuminate\Database\Eloquent\Model;
class Painting extends Model
{
}