コード例 #1
0
ファイル: MainController.php プロジェクト: axovel/tattoo
 /**
  * Display search results of studios
  *
  * @return View
  */
 public function addArtist(Request $request)
 {
     if ($request->input('tag')) {
         $tag = $request->input('tag');
         $artists = Artist::whereHas('studios', function ($query) use($tag) {
             $query->where('name', 'LIKE', '%' . $tag . '%');
         })->orWhere('firstname', 'like', '%' . $tag . '%')->orWhere('lastname', 'like', '%' . $tag . '%')->orWhere('city', 'like', '%' . $tag . '%')->orWhere('address', 'like', '%' . $tag . '%')->orWhere('bio', 'like', '%' . $tag . '%')->get();
     } else {
         $artists = Artist::where('verified', true)->get();
     }
     return view('pages.addartist', ['artists' => $artists]);
 }