First of all I'm wondering if this is even possible in Laravel?
I have this code:
$master_array = $_POST['master_search_array'];
$count = count($master_array);
$master_string = '';
for($i=0; $i<$count; $i++) {
if($master_array[$i] == "Dining"){
$master_string .= "where('dining', 'dining')";
}
if($master_array[$i] == "Party"){
$master_string .= "where('party','party')";
}
....ETC you get the point
}
$tours = DB::table('tours')->$master_string->get();
return $tours;
So at the end I should get something like this:
$tours = DB::table('tours')->where('dining', 'dining)->where('party','party')->get();
How can I do this in laravel, it gives me an error, no matter if I pass it as $master_string or {{$master_string}}.