public function run() { $faker = Faker::create(); foreach (range(1, 10) as $index) { Meal::create([]); } }
public function add_meal($ItemID, $Count, $VegCount, $Chefs_Tasting = '0') { $Count = (int) $Count; $VegCount = (int) $VegCount; $meal = Meal::get_from_id($ItemID); $amount = new Amount($Count * $meal->Price + $VegCount * $meal->Vegetarian_Price); $this->_add_amount($amount); $this->meals[] = array('Meal' => $meal, 'Count' => $Count, 'VegCount' => $VegCount, 'Amount' => $amount->rounded, 'Chefs_Tasting' => $Chefs_Tasting); if ($Count) { $this->seperated_meals[] = array('Meal' => $meal, 'Count' => $Count, 'ItemName' => $meal->ItemName, 'Description' => $meal->Description, 'Chefs_Tasting' => $Chefs_Tasting); } if ($VegCount) { $this->seperated_meals[] = array('Meal' => $meal, 'Count' => $VegCount, 'ItemName' => $meal->ItemName . ' - Vegetarian', 'Description' => $meal->Description . ' - Vegetarian', 'Chefs_Tasting' => $Chefs_Tasting); } }
public static function api_call($f3) { $orm = $f3->get("meal_overview_orm"); $result = $orm->find(); $data_array = array(); foreach ($result as $meal) { $mealValues = array(); $mealValues["id"] = $meal->id; $mealValues["name"] = $meal->mealName; $mealValues["menu"] = $meal->menuName; $mealValues["category"] = $meal->categoryName; $mealValues["mealInfo"] = $meal->info; $mealValues["ingredients"] = Meal::fetch_ingredients($meal->id); $data_array[] = $mealValues; } header('Content-type: application/javascript'); echo $_GET['callback'] . '(' . json_encode($data_array) . ')'; }
# Set the delivery dates $order->DeliveryDate = Gadget::$date_do->format(DATE_FORMAT_MYSQL); $order_weekday->DeliveryDate = Gadget::$date_do->format(DATE_FORMAT_MYSQL); $order_weekend->DeliveryDate = Gadget::$date_do_weekend->format(DATE_FORMAT_MYSQL); # Set the customer $order->CustomerID = $krustomer->CustomerID; $order_weekday->CustomerID = $krustomer->CustomerID; $order_weekend->CustomerID = $krustomer->CustomerID; # Add the delivery fee $order->add_delivery_fee($krustomer->DeliveryAddress->Zip); $order_weekday->add_delivery_fee($krustomer->DeliveryAddress->Zip); $order_weekend->add_delivery_fee($krustomer->DeliveryAddress->Zip); // See if there is a volume discount $num_entrees = 0; foreach ($_SESSION['new_order']['meals'] as $k => $v) { $meal = Meal::get_from_id($k); if ($meal->MenuID != 4) { $num_entrees += $v['n']; } } if ($num_entrees > 5) { $volume_discount = true; } else { $volume_discount = false; } # Add the meals foreach ($_SESSION['new_order']['meals'] as $key => $value) { $order->add_meal($key, (int) $value['n'], (int) $value['v'], '0', $volume_discount); } # Now separate for each order $num_entrees = 0;
private function allMeals() { $meals = Meal::all(); return View::make('edit')->with(array('meals' => $meals)); }
$errors = Meal::Delete($_REQUEST['id']); if ($errors) { $model = Meal::Get($_REQUEST['id']); $view = "meals/delete.php"; } else { header("Location: ?sub_action={$sub_action}&id={$_REQUEST['id']}"); die; } break; case 'search_GET': $model = Meal::Search($_REQUEST['q']); $view = 'meals/index.php'; break; case 'index_GET': default: $model = Meal::Get(); $view = 'meals/index.php'; break; } switch ($format) { case 'json': echo json_encode($model); break; case 'plain': include __DIR__ . "/../Views/{$view}"; break; case 'web': default: include __DIR__ . "/../Views/shared/_Template.php"; break; }
<?php /* |-------------------------------------------------------------------------- | Application Routes |-------------------------------------------------------------------------- | | Here is where you can register all of the routes for an application. | It's a breeze. Simply tell Laravel the URIs it should respond to | and give it the Closure to execute when that URI is requested. | */ Route::get('/', 'MealController@mealPicker'); Route::get('edit', function () { $meals = Meal::all(); return View::make('edit')->with(array('meals' => $meals)); }); Route::post('add', 'MealController@add'); Route::post('remove', 'MealController@remove'); Route::get('calendar', function () { return View::make('calendar'); }); Route::get('users', function () { $users = User::all(); return View::make('users')->with('users', $users); });
} else { header("Location: ?sub_action={$sub_action}&id={$_REQUEST['id']}"); die; } break; case 'search_GET': $meals = Meal::Search($_REQUEST['q']); $view = 'meals/meal.php'; break; case 'meal_GET': case 'view_GET': $meals = Meal::Get($_REQUEST['id']); $view = "meals/view.php"; break; default: $meals = Meal::Get(); $view = 'meals/meal.php'; break; } switch ($format) { case 'json': echo json_encode($meals); break; case 'plain': include __DIR__ . "/../Views/{$view}"; break; case 'web': default: include __DIR__ . "/../Views/shared/_Template.php"; break; }
public function read() { return Meal::read($this->params); }
public function get_meals($f3) { Meal::api_call($f3); }