Commit 270ac7c9 authored by King Alex's avatar King Alex

ajout fonctions de recherche

parent 23f5dbd4
......@@ -33,12 +33,53 @@ class RecipeController extends BaseController {
// TODO pass list of recipes containing the search term.
public function search(){
// example:
/*
Product::with('owner')->where(function($query) use ($searchText)
{
$query->where('product_name', 'LIKE', '%' . $searchText . '%');
$columns = ['product_code', 'place_location', 'remark'];
foreach ($columns as $column ) {
$query->orWhere($column, 'LIKE', '%' . $searchText . '%');
}
$query->orWhereHas('owner', function($q) use ($searchText) {
$q->where(function($q) use ($searchText) {
$q->where('name', 'LIKE', '%' . $searchText . '%');
$q->orWhere('company_name', 'LIKE', '%' . $searchText . '%');
});
});
});
*/
$searchText = Input::get('q');
var_dump($searchText);
/*
$results = Profile::where('location_id', '=', $locationId)
->whereHas('services', function($query) use ($serviceId){
$query->where('services.id', '=', $serviceId);
})->get();
*/
$searchIngredients = Ingredient::where('name', 'LIKE', '%'.$searchText.'%')->get();
$searchCategory =Category::where('display_name', 'LIKE', '%'.$searchText.'%')->get();
$searchRecipes = Recipe::where('title', 'LIKE', '%'.$searchText.'%')->orwhere('description', 'LIKE', '%'.$searchText.'%')->get();
var_dump($ingredients);
die();
$results = Recipe::where('location_id', '=', $locationId)
->whereHas('services', function($query) use ($serviceId){
$query->where('services.id', '=', $serviceId);
})->get();
var_dump($recipeList);
die();
foreach ($recipeList as $recipe) {
var_dump($recipe['title']);
}
// TODO Get collection of recipes
//get keywords input for search
$keyword= Input::get('q');
var_dump('searched for : '.$keyword);
return View::make('templates.recipe.list');
return View::make('templates.recipe.list')->with('recipes',$list);
}
public function doCreate(){
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment