$text="Samsung Galaxy s21 ";
$product= Product::Select('*')->where('name', 'like', "%{$text}%")->get();
如何从$product
中得到Galaxy
相关产品
$product= Product::where('name', 'like', '%' . $text . '%')->get();
或
$product= Product::where('name', 'like', "%$text%")->get();
你可以这样做。从这个帖子里得到的,larvel -5 'LIKE'等效(雄辩)