/** * Remove the specified resource from storage. * * @param MessageRequest $request * @return Response */ public function mutilDestroy(MessageRequest $request) { Message::whereIn('id', $request->input('checkbox'))->delete(); return new JsonResponse(['message' => Lang::get('message.destroy')], 200); }
public function getShortDescription(Request $request) { //fetching all the receipient ids $userId = Auth::user()->email; $message = MessageReceipient::where('receipient_ID', $userId)->get(); $metaIds = array(); //fetching meta ids and storing in the array foreach ($message as $key => $value) { $metaIds[] = $value['meta_Id']; } //getting all the message corresponding to a user $message = Message::whereIn('meta_Id', $metaIds)->groupBy('from')->get(); foreach ($message as $key => $value) { //fetching user id on the basis of email $email = $value['from']; $userName = User::where('email', $email)->pluck('id'); //converting time into epoch value $epoch = strtotime($value['created_at']); $value['epoch'] = $epoch; //user name on the basis of email if ($value['from'] == $userId) { //if message is sending by logged in user set "me" $value['from'] = "Me"; } else { //if message is sending by other email address then set user name instead of email id $value['from'] = UserDetail::where('userid', $userName)->pluck('name'); } //getting user profile picture path $profilePic = UserDetail::where('userid', $userName)->pluck('profilePicPath'); $value['path'] = $profilePic; } return $message; }