コード例 #1
0
 public function search(Request $request)
 {
     $q = $request->get('q');
     $posts = Post::orWhere('title', 'like', '%' . $q . '%')->orWhere('content', 'like', '%' . $q . '%')->get();
     $locations = Location::orWhere('name', 'like', '%' . $q . '%')->orWhere('address', 'like', '%' . $q . '%')->get();
     return view('admin.admin.search', compact('posts', 'locations'));
 }