本文整理汇总了PHP中Bar::find方法的典型用法代码示例。如果您正苦于以下问题:PHP Bar::find方法的具体用法?PHP Bar::find怎么用?PHP Bar::find使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Bar
的用法示例。
在下文中一共展示了Bar::find方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: array
$mail->Subject = 'Somebody sent you a token!';
$mail->Body = 'HEY YOU GUYS! LOOK WAT I DONE DID!!!!!!.';
$mail->AltBody = 'Received token.';
$email = $_POST['email'];
$name = $_POST['name'];
if (!$mail->send()) {
$message = 'Message could not be sent. <p>';
} else {
$message = 'Message has been sent.';
}
return $app['twig']->render("email.html.twig", array('message' => $message));
});
$app->post("/add_preferred_bar/{id}", function ($id) use($app) {
$user = Patron::find($id);
$all_bars = Bar::getAll();
$bar = Bar::find($_POST['add_bar']);
$user->addPreferredBar($bar);
return $app['twig']->render("patron.html.twig", array('user' => $user, 'user_tokens' => $user->getTokens(), 'all_bars' => $all_bars, 'preferred_bars' => true, 'send_token' => false, 'token_form' => false, 'edit_user' => false));
});
// $app->delete("/delete_preferred_bar/{id}/{bar_id}", function($id, $bar_id) use($app) {
// $user = Patron::find($id);
// $all_bars = Bar::getAll();
// $bar = Bar::find($bar_id);
// $user->deleteBar($bar);
// return $app['twig']->render("patron.html.twig", array(
// 'user' => $user,
// 'user_tokens' =>$user->getTokens(),
// 'all_bars' => $all_bars,
// 'preferred_bars' => false,
// 'send_token' => false,
// 'token_form' => false,
示例2: getPreferredBars
function getPreferredBars()
{
$returned_bars = $GLOBALS['DB']->query("SELECT * FROM preferbars WHERE patron_id = {$this->getId()};");
$preferred_bars = array();
foreach ($returned_bars as $bar) {
$bar_id = $bar['bar_id'];
$new_bar = Bar::find($bar_id);
array_push($preferred_bars, $new_bar);
}
return $preferred_bars;
}
示例3: function
//Post Select Bar {id}/{friend_id}
$app->post("/select_bar/{id}/{friend_id}", function ($id, $friend_id) use($app) {
$user = Patron::find($id);
$friend = Patron::find($friend_id);
$friend_bars = $friend->getPreferredBars();
$selected_bar = Bar::find($_POST['select_bar']);
$shopping_cart = null;
$displayed_cart = null;
return $app['twig']->render("send_token.html.twig", array('user' => $user, 'friend' => $friend, 'friend_bars' => $friend_bars, 'selected_bar' => $selected_bar, 'shopping_cart' => $shopping_cart, 'displayed_cart' => $displayed_cart));
});
//Post Add Token {id}/{friend_id}/{bar_id}
$app->post("/add_token/{id}/{friend_id}/{bar_id}", function ($id, $friend_id, $bar_id) use($app) {
$user = Patron::find($id);
$friend = Patron::find($friend_id);
$friend_bars = $friend->getPreferredBars();
$selected_bar = Bar::find($bar_id);
$item_id = $_POST['item_id'];
$item = Item::find($item_id);
$menu_id = $selected_bar->getMenuId($item);
$new_token = new Token($friend_id, $menu_id, $id);
$new_token->save();
$mail = new PHPMailer();
// $mail->SMTPDebug = 3;
$mail->isSMTP();
$mail->Host = 'smtp.gmail.com';
$mail->SMTPAuth = true;
$mail->Username = 'beerme.token@gmail.com';
$mail->Password = 'b33rm3123';
$mail->STMPSecure = 'ssl';
$mail->Port = 587;
$email_confirmation = $friend->getEmail();
示例4: testFind
function testFind()
{
$name = "Side Street";
$phone = "555-555-5555";
$address = "123 ABC. Street";
$website = "http://www.sidestreetpdx.com";
$test_bar = new Bar($name, $phone, $address, $website);
$test_bar->save();
$name2 = "ABC Pub";
$phone2 = "444-444-4444";
$address2 = "321 CBA Street";
$website2 = "http://www.sesamestreet.com";
$test_bar2 = new Bar($name2, $phone2, $address2, $website2);
$test_bar2->save();
$result = Bar::find($test_bar->getId());
$this->assertEquals($test_bar, $result);
}