方法 whereRaw 不存在
Method whereRaw does not exist
我正在尝试在我的查询生成器中使用 WhereRaw,但我收到消息 Method whereRaw does not exist.
我目前正在使用 Laravel 版本 5.5.40 和 php 版本 7.0.30
这是我要进行的查询:
$places = Places::with('locations.places')->get()->whereRaw( 'LOWER(`title`) like ?', $id );
我是不是漏掉了什么?
试试这个
$places = Places::with('locations.places')->whereRaw( 'LOWER(`title`) like ?', $id )->get();
WhereRaw方法会先到后get
$places = Places::with('locations.places')->whereRaw( 'LOWER(`title`) like ?', $id )->get();
你应该试试这个:
$places = Places::with('locations.places')->whereRaw(DB::raw('LOWER(`title`) like ?', $id ))->get();
我正在尝试在我的查询生成器中使用 WhereRaw,但我收到消息 Method whereRaw does not exist.
我目前正在使用 Laravel 版本 5.5.40 和 php 版本 7.0.30
这是我要进行的查询:
$places = Places::with('locations.places')->get()->whereRaw( 'LOWER(`title`) like ?', $id );
我是不是漏掉了什么?
试试这个
$places = Places::with('locations.places')->whereRaw( 'LOWER(`title`) like ?', $id )->get();
WhereRaw方法会先到后get
$places = Places::with('locations.places')->whereRaw( 'LOWER(`title`) like ?', $id )->get();
你应该试试这个:
$places = Places::with('locations.places')->whereRaw(DB::raw('LOWER(`title`) like ?', $id ))->get();