laravel 5.4查询异常未知列错误

时间:2017-02-26 16:26:35

标签: php laravel-5.4

我有这个统计。

Route::get('/artist/{id}/{slug}', 'HomeController@artist')->name('artist');

这是模范的艺术家。

public function artist($id,$slug){
        $artist = Artist::where('id', $id)->where('slug', $slug)->first();
        $hits = Artist::where('id', $id)->where('slug', $slug)->increment('week_hits');
        return view('front.artist', compact('artist'));
    }

我想要的是在我的艺术家表中增加week_hits字段。每当用户访问特定的艺术家页面时。

但是我得到了这个错误。

QueryException in Connection.php line 647:
SQLSTATE[42S22]: Column not found: 1054 Unknown column 'week_hits' in 'field list' (SQL: update `artists` set `week_hits` = `week_hits` + 1, `updated_at` = 2017-02-26 16:20:04 where `id` = 1 and `slug` = xasan-aadan-samatar)

0 个答案:

没有答案
相关问题