コード例 #1
0
 /**
  * Display a listing of the resource.
  *
  * @return \Illuminate\Http\Response
  */
 public function index(Request $request)
 {
     $items = !filter_request($request, 'a_filter') ? $items = Artist::select('*')->paginate(get_setting('pagination')) : ($items = Artist::select('*')->filter($request, 'a_')->paginate(get_setting('pagination')));
     return view('admin.artists.index', compact('items', 'request'));
 }
コード例 #2
0
 public function gallerySearch(Request $request)
 {
     $SearchQuery = [0 => $request->input('keyword'), 1 => $request->input('kunstenaar'), 2 => $request->input('genre'), 3 => $request->input('categorie'), 4 => $request->input('grootte'), 5 => $request->input('materiaal'), 6 => $request->input('techniek')];
     $artworks = DB::table('artworks');
     if ($SearchQuery[0] != "") {
         $artworks = $artworks->where('title', 'like', '%' . $SearchQuery[0] . '%');
         $tagResults = DB::table('artworks')->join('tagging_tagged', 'taggable_id', '=', 'artworks.id')->where('tag_name', 'like', '%' . $SearchQuery[0] . '%')->groupBy('title');
     }
     if ($SearchQuery[1] != 'Alle Kunstenaars') {
         $artworks = $artworks->where('artist', '=', $SearchQuery[1]);
         if (isset($tagResults)) {
             $tagResults = $tagResults->where('artist', '=', $SearchQuery[1]);
         }
     }
     if ($SearchQuery[2] != 'Alle Genres') {
         $artworks = $artworks->where('genre', '=', $SearchQuery[2]);
         if (isset($tagResults)) {
             $tagResults = $tagResults->where('genre', '=', $SearchQuery[2]);
         }
     }
     if ($SearchQuery[3] != 'Alle Categorieën') {
         $artworks = $artworks->where('category', '=', $SearchQuery[3]);
         if (isset($tagResults)) {
             $tagResults = $tagResults->where('category', '=', $SearchQuery[3]);
         }
     }
     if ($SearchQuery[4] != 'Alle Grootte') {
         $artworks = $artworks->where('size', '=', $SearchQuery[4]);
         if (isset($tagResults)) {
             $tagResults = $tagResults->where('size', '=', $SearchQuery[4]);
         }
     }
     if ($SearchQuery[5] != 'Alle Materialen') {
         $artworks = $artworks->where('material', '=', $SearchQuery[5]);
         if (isset($tagResults)) {
             $tagResults = $tagResults->where('material', '=', $SearchQuery[5]);
         }
     }
     if ($SearchQuery[6] != 'Alle Technieken') {
         $artworks = $artworks->where('technique', '=', $SearchQuery[6]);
         if (isset($tagResults)) {
             $tagResults = $tagResults->where('technique', '=', $SearchQuery[6]);
         }
     }
     if (isset($tagResults)) {
         $artworks = array_merge($artworks->get(), $tagResults->get());
     } else {
         $artworks = $artworks->get();
     }
     if (!empty($artworks)) {
         foreach ($artworks as $results) {
             $searchResults[$results->slug] = $results;
         }
         ksort($searchResults);
     } else {
         $searchResults = [];
     }
     if ($request->input('kunstenaar') != "Alle Kunstenaars") {
         $artist = Artist::select('name')->where('id', $request->input('kunstenaar'))->first()->toArray();
     } else {
         $artist['name'] = "Alle Kunstenaars";
     }
     return View::make('/gallery/search', compact('searchResults', 'request', 'artist'));
 }