public function getApplication() { $application = Application::with('school', 'team', 'ratings', 'notes')->firstOrCreate(['user_id' => $this->id]); if (!$application->team_id) { //assign them to a team of 1 in lieu of no team $team = new Team(); $team->code = md5(Carbon::now() . getenv("APP_KEY")); $team->save(); $application->team_id = $team->id; } $application->save(); $application->teaminfo = $application->team; $application->schoolinfo = $application->school; return $application; }
public function getApplication($id) { $user = Auth::user(); if (!Auth::user()->hasRole('exec')) { //TODO middleware perhaps? return; } $app = Application::with('user', 'school', 'team', 'notes.user')->find($id); $app->resumeURL = GeneralController::resumeUrl($app->user->id, 'get'); $app->myrating = ApplicationRating::where('application_id', $id)->where('user_id', $user->id)->first(); $app->github_summary = $app->getGithubSummary(); return $app; }
/** * 选课申请进度查询 * @author FuRongxin * @date 2016-02-23 * @version 2.0 * @return \Illuminate\Http\Response 选课申请进度列表 */ public function index() { $apps = Application::with('term')->whereXh(Auth::user()->xh)->orderBy('xksj', 'desc')->get(); return view('application.index')->withTitle('课程申请进度')->withApps($apps); }