本文整理汇总了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');
}
}
示例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;
}