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


PHP Guardian::save方法代码示例

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


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

示例1: addGuardian

 /**
  * @before _secure, _school
  */
 public function addGuardian($scholar_user_id)
 {
     $usr = \User::first(array("id = ?" => $scholar_user_id), array("id"));
     if (!$usr) {
         self::redirect("/school");
     }
     $this->setSEO(array("title" => "Parent Info | Student | School"));
     $view = $this->getActionView();
     if (RequestMethods::post("action") == "saveParent") {
         $opts = array();
         $opts["name"] = RequestMethods::post("name");
         $opts["email"] = RequestMethods::post("email");
         $opts["phone"] = RequestMethods::post("phone");
         try {
             $user = $this->_createUser($opts);
             $loc = new Location(array("address" => RequestMethods::post("address"), "city" => RequestMethods::post("city"), "latitude" => "", "longitude" => "", "user_id" => $user->id));
             $loc->save();
             $guardian = new Guardian(array("user_id" => $user->id, "scholar_user_id" => $scholar_user_id, "relation" => RequestMethods::post("relation"), "occupation" => RequestMethods::post("occupation"), "qualification" => RequestMethods::post("qualification"), "location_id" => $loc->id));
             $guardian->save();
             $view->set("success", $guardian->relation . " info saved successfully!!");
         } catch (\Exception $e) {
             $view->set("error", true);
             $view->set("message", $e->getMessage());
         }
     }
 }
开发者ID:SwiftSchool,项目名称:School,代码行数:29,代码来源:student.php


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