/** * Returns the collection to which the user belongs * * @param $user User * @return Object */ public static function getUser($user) { if (strcmp($user->rank, 'university') === 0) { return University::find($user->_id); } else { if (strcmp($user->rank, 'teacher') === 0) { return Teacher::find($user->_id); } else { if (strcmp($user->rank, 'student') === 0) { return Student::find($user->_id); } else { return null; } } } }
/** * Show view university profile * * @return View */ public function showProfile() { return View::make('university.profile')->with(array('university' => University::find(Auth::id()))); }