/** * Store a new message in the database. * * @param SendMessageRequest $request * @return Response */ public function store(SendMessageRequest $request) { $cId = loadConversation($request->username)[0]->conversationId; storeMessage($cId, $request->message); return redirect('messages/' . $request->username); }
<?php include '../include/config.php'; include '../include/db.php'; dbconnect(); include '../include/checkprelogin.php'; if (isset($_POST["message"]) && isset($_POST["regId"])) { $message = $_POST["message"]; $gcm_regid = $_POST["regId"]; // GCM Registration ID $data = 0; if (isset($_POST["data"])) { $data = 1; } $mid = storeMessage($message, $gcm_regid, $data); if (isset($_POST["data"])) { storeData($mid, $_POST["data"]); } } else { // message details missing } dbclose();
public function storeMessage(SendMessageRequest $request) { storeMessage($request->conversationId, $request->message); return redirect('groups/' . $request->groupname); }