当前位置: 首页>>代码示例>>PHP>>正文


PHP Package::first方法代码示例

本文整理汇总了PHP中Package::first方法的典型用法代码示例。如果您正苦于以下问题:PHP Package::first方法的具体用法?PHP Package::first怎么用?PHP Package::first使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Package的用法示例。


在下文中一共展示了Package::first方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: editPackage

 /**
  * @before _secure, _vendor
  */
 public function editPackage($package_id)
 {
     $this->seo(array("title" => "Edit Packages", "view" => $this->getLayoutView()));
     $view = $this->getActionView();
     $package = Package::first(array("id = ?" => $package_id, "organization_id = ?" => $this->organization->id));
     if (!$package) {
         $this->redirect("/vendor");
     }
     $tests = Test::all(array(), array("id", "title"));
     $items = Item::all(array("package_id = ?" => $package->id));
     $sorted = array();
     foreach ($items as $i) {
         $sorted[$i->test_id] = $i;
     }
     $fields = $package->render();
     $errors = array();
     $view->set("fields", $fields);
     if (RequestMethods::post("action") == "savePackage") {
         foreach ($fields as $f) {
             $package->{$f}['name'] = RequestMethods::post($f['name']);
         }
         if ($package->validate()) {
             $package->save();
             $view->set("message", "Package Saved Successfully");
         } else {
             $errors = $package->errors;
         }
         $sorted = $this->_saveTests($package, $sorted);
     }
     $view->set("package", $package)->set("items", $sorted)->set("tests", $tests)->set("errors", $errors);
 }
开发者ID:HLitmus,项目名称:WebApp,代码行数:34,代码来源:promotion.php

示例2: booking_form

 public function booking_form($package_id)
 {
     $view = $this->getActionView();
     $package = Package::first(array('id = ?' => $package_id));
     $view->set('package', $package);
     /*        if($this->user){
                 if(RequestMethods::){
     
                     
                 }
             }else{
                 
                echo "<script> alert('login first') </script>";
             }
     */
 }
开发者ID:shreyanshgoel,项目名称:tours,代码行数:16,代码来源:travels.php

示例3: editPackage

 /**
  * @before _secure, _admin
  */
 public function editPackage($package_id)
 {
     $package = Package::first(array("id = ?" => $package_id));
     if (!$package) {
         $this->redirect("/admin");
     }
     $this->seo(array("title" => "Create Package", "view" => $this->getLayoutView()));
     $view = $this->getActionView();
     $errors = array();
     if (RequestMethods::post("action") == "submitPackage") {
         $response = $this->_savePackage($package);
         if ($response["success"]) {
             $view->set("success", "Package is Updated");
         } else {
             $errors = $response["errors"];
         }
     }
     $items = Item::all(array(), array("id", "name"));
     $view->set("items", $items)->set("package", $package)->set("errors", $errors);
 }
开发者ID:SwiftDeal,项目名称:detectr,代码行数:23,代码来源:marketing.php

示例4: addSubscription

 protected function addSubscription($transaction)
 {
     $package = Package::first(array("id = ?" => $transaction->property_id));
     $items = json_decode($package->item);
     $user = User::first(array("id = ?" => $transaction->user_id));
     $user->live = 1;
     $user->save();
     $days = (int) $package->period;
     foreach ($items as $key => $value) {
         $s = new Subscription(array("user_id" => $user->id, "item_id" => $value, "period" => $days, "expiry" => strftime("%Y-%m-%d", strtotime("+" . ($days + 1) . " Day")), "is_promo" => false));
         $s->save();
     }
     $this->session($user);
     $this->redirect('/member/index.html');
 }
开发者ID:SwiftDeal,项目名称:detectr,代码行数:15,代码来源:plan.php


注:本文中的Package::first方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。