/** * Display a listing of the resource. * GET * @return Response */ public function index() { $uid_from = Input::get('uid_from'); $uid = Input::get('uid'); if (!empty($uid_from)) { // get all messsages from uid to / from return Messages::whereRaw('uid_from = ' . $uid_from . ' AND uid_to=' . $uid . '')->get(); } else { // get list of users return Messages::whereRaw('uid_to=' . $uid . '')->get(); } }