Eloquent ORM过滤斜线字符后的内容

Eloquent ORM filter the content after slash character

我正在尝试以 app/img.png 的形式获取数据。当我使用 Eloquent ORM 时,结果将得到 app (斜线后的内容将被过滤)。但是,我尝试使用 Query Builder,它确实有效!结果将显示 app/img.png。我用谷歌搜索过,但没有找到。如果我想使用 Eloquent ORM,应该如何解决这个问题?

-- 编辑--

Eloquent

$images = Image::where('name', 'LIKE', '%' . $request->get('q') . '%')
                 ->select('name', 'URL')
                 ->get();

QB

$images = \DB::table('images')
                 ->where('name', 'LIKE', '%' . $request->get('q') . '%')
                 ->select('name', 'URL')
                 ->get();

你应该这样做:

$images = Image::select('name', 'URL')
          ->where('name', 'LIKE', '%' . $request->get('q') . '%')
          ->get();

感谢您的所有回答。几周后,我发现我在模型中设置了 $primaryKey = 'URL',但我没有设置 $keyType = 'string'。设置后$keyType = 'string',一切正常!