/** * Return the view for the showMessage page * * @return void */ public function showMessage($message_id = 0) { $page_details = array('title' => 'Laravel home', 'meta_description' => 'Laravel Skeleton description home', 'meta_keywords' => 'Laravel Skeleton keywords home', 'pageURL' => '/', 'twitter_description' => 'Laravel Skeleton twitter description home', 'fb_description' => 'Laravel Skeleton fb description home'); $current_page_details = Common::setPageDetails($page_details); // Redirect back to home page if the Message id is not given if (!$message_id) { return Redirect::to('/'); } // Get Message details and Redirect back to home page if Message doesn't exist $message = MessageDetail::whereId($message_id)->first(); if (!$message) { return Redirect::to('/'); } // Get User details and Redirect back to home page if User doesn't exist $user = UserDetail::whereId($message->user_id)->first(); if (!$user) { return Redirect::to('/'); } // Return the rendered template with the variables passed return View::make('layouts/default')->with('template', 'submitted-data')->with('page_details', $current_page_details)->with('response_data', $message->getAttributes())->with('user', $user->getAttributes()); }
public function getMessageDetailsJson($message_id = 0) { $getMessageDetails = array(); $getMessageDetails['hasErrors'] = true; $getMessageDetails['message'] = ''; $getMessageDetails['data'] = ''; // Get the Message details provided by the database $messageDetails = MessageDetail::whereId($message_id)->first(); if (empty($messageDetails)) { $getMessageDetails['message'] = 'No Message exists for that id.'; } else { $getMessageDetails['hasErrors'] = false; $getMessageDetails['data'] = $messageDetails->toArray(); } if (Request::ajax()) { return Response::json($getMessageDetails); } else { $page_details = array('title' => 'Laravel home', 'meta_description' => 'Laravel Skeleton description home', 'meta_keywords' => 'Laravel Skeleton keywords home', 'pageURL' => '/', 'twitter_description' => 'Laravel Skeleton twitter description home', 'fb_description' => 'Laravel Skeleton fb description home'); $current_page_details = Common::setPageDetails($page_details); return View::make('layouts/default')->with('template', 'submitted-data')->with('page_details', $current_page_details)->with('response_data', $getMessageDetails); } }