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


PHP History::create方法代码示例

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


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

示例1: saveHistoryAction

 public function saveHistoryAction()
 {
     if ($this->request->isPost() == true) {
         $request = json_decode(file_get_contents("php://input"));
         $history = new History();
         $history->history_string = $request->string;
         $history->create() == false ? $this->response->setStatusCode(403, 'Server Error') : $this->response->setStatusCode(201, 'OK');
     } else {
         $this->response->setStatusCode(403, 'Bad request');
     }
 }
开发者ID:mezhik91,项目名称:CalculatorNg,代码行数:11,代码来源:HistoryController.php

示例2: sendMail

 private static function sendMail($curr_uid, $matched_uid, $restaurant_id)
 {
     $user1 = User::find($curr_uid);
     $user2 = User::find($matched_uid);
     //Add to User1's history
     History::create(['uid' => $curr_uid, 'matched_id' => $matched_uid, 'restaurant_id' => $restaurant_id]);
     //Add to User2's history
     History::create(['uid' => $matched_uid, 'matched_id' => $curr_uid, 'restaurant_id' => $restaurant_id]);
     $email_data1 = array('recipient' => $user1->email, 'subject' => 'Congratulations! We found you a match!');
     $view_data1 = ['email' => $user2->email, 'gender' => $user2->gender, 'restaurant' => $restaurant_id];
     Mail::send('emails.match', $view_data1, function ($message) use($email_data1) {
         $message->to($email_data1['recipient'])->subject($email_data1['subject']);
     });
     $email_data2 = array('recipient' => $user2->email, 'subject' => 'Congratulations! We found you a match!');
     $view_data2 = ['email' => $user1->email, 'gender' => $user1->gender, 'restaurant' => $restaurant_id];
     Mail::send('emails.match', $view_data2, function ($message) use($email_data2) {
         $message->to($email_data2['recipient'])->subject($email_data2['subject']);
     });
     return true;
 }
开发者ID:neostoic,项目名称:sharemeal,代码行数:20,代码来源:SchedulerController.php


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