public function setReadMsgs() { $from_id = Input::get("from_id"); $to_id = Input::get("to_id"); $inbox_select = Inbox::select('id')->where('from_id', '=', $from_id)->where('to_id', '=', $to_id)->get(); foreach ($inbox_select as $inbox_msg) { $inbox = Inbox::find($inbox_msg->id); $inbox->read = 1; $inbox->save(); } return Response::json(array('validation_failed' => 0)); }
/** * Display a listing of the resource. * * @return Response */ public function index() { $id = Auth::id(); $unread = Inbox::where('mail_read', '=', '0')->where('member_id', '=', $id)->get(); echo $unread->count(); /*foreach ($inboxes as $inbox) { $count=$inbox->member_id; echo $count; } */ //echo $created_at; //echo $msgs; // HelperController::getInbox('subject'); }
private function inboxMessage($result) { $inbox = new Inbox(); $inbox->fromNumber = $result->from; $inbox->to = $result->to; $inbox->message = $result->text; $inbox->date = $result->date; $inbox->linkId = $result->linkId; $inbox->lastReceivedId = $result->id; $inbox->save(); }
/** * Update the specified resource in storage. * * @param int $id * @return Response */ public function sendRead() { $members = Member::all(); //all data of member collection $inbox_id = HelperController::getPage(); $id = Auth::id(); $author = User::find($id); $inbox = Inbox::find($inbox_id); //find data in Inbox collection $unread = Inbox::where('mail_read', '=', '0')->where('member_id', '=', $id)->get()->count(); //mailbox view return view('vendor/flatAdmin/mailRead', compact(array('members', 'author', 'inbox', 'unread', 'id'))); }