當前位置: 首頁>>代碼示例>>PHP>>正文


PHP Bar::find方法代碼示例

本文整理匯總了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,
開發者ID:CaseyH33,項目名稱:Beer_Me,代碼行數:31,代碼來源:app.php

示例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;
 }
開發者ID:kellimargaret,項目名稱:Beer-Me,代碼行數:11,代碼來源:Patron.php

示例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();
開發者ID:kellimargaret,項目名稱:Beer-Me,代碼行數:31,代碼來源:app.php

示例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);
 }
開發者ID:kellimargaret,項目名稱:Beer-Me,代碼行數:17,代碼來源:BarTest.php


注:本文中的Bar::find方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。