私は自動提案のようにしようとしています。以下のコードを参照してください。は、変数が存在していても '未定義の変数'を返します。
//search suggestion base on the string criteria given
public function search_tag(Request $request){
$tags = tags::where(function($query){
foreach(item_tags::where('item_id',$request->item_id)->get() as $i){ //this is the line 192
$query->orWhere('tag_id','!=',$i->tag_id);
}
})->where('tag_name','LIKE','%'.$request->ss.'%')->get();
return response()->json([ 'success' => true, 'tags' => $tags, 'ss' => $request->ss ]);
}
が、それは、このエラーにItemsController.phpライン192で
ErrorException私をスロー:あなたは '$要求' 変数がある見ることができるように 要求
:未定義の変数を
public function search_tag(Request $request){
しかし、なぜそれが私に「requ est '変数は定義されていませんか?任意のアイデア、助けてください?