/** * Display the specified resource. * * @param int $id * @param FellowshipTransformer $transformer * @return \Illuminate\Http\Response */ public function show($id, FellowshipTransformer $transformer) { $fellowship = Fellowship::find($id); if (!$fellowship) { return $this->respondNotFound('Fellowship does not exist'); } return $this->respond(['data' => $transformer->transform($fellowship->toArray())]); }
public function getMeetingsMeta($fellowship) { return Fellowship::join('fellowships_meta as fm', 'fm.fellowship_id', '=', 'fellowships.id')->join('meta as m', 'm.id', '=', 'fm.meta_id')->where('fellowships.abbreviation', $fellowship)->first(); }
* Cron jobs */ Route::group(array('prefix' => 'cron'), function () { Route::get('birthdays', 'Admin\\CronController@birthdays'); Route::get('belly-button-birthdays', 'Admin\\CronController@bellyButton'); Route::get('my-meetings', 'Admin\\CronController@myMeetings'); Route::get('membership-status/{days}', 'CronController@membershipStatus'); Route::get('news', 'Admin\\CronController@news'); Route::get('renewal/{renewalTime}', 'Admin\\CronController@renewal'); }); /** * PDFs */ Route::get('pdf/meetings/fellowship/{fellowship}', function ($fellowship) { $meetings = Meeting::leftJoin('fellowships', 'fellowships.id', '=', 'meetings.fellowship_id')->where('abbreviation', $fellowship)->where('meetings.active', 1)->orderBy('day_index')->orderBy('meeting_time')->get(); $fs = Fellowship::where('abbreviation', $fellowship)->first(); $html = view('pdfs.meetings-by-fellowship', array('meetings' => $meetings, 'fellowship' => $fs))->render(); $pdf = App::make('dompdf.wrapper'); return $pdf->loadHtml($html)->download('lambda-' . strtolower($fellowship) . '-schedule.pdf'); }); Route::get('pdf/meetings/day/{day}', function ($day) { $days = array('mon' => 1, 'tue' => 2, 'wed' => 3, 'thu' => 4, 'fri' => 5, 'sat' => 6, 'sun' => 7); $meetings = Meeting::leftJoin('fellowships', 'fellowships.id', '=', 'meetings.fellowship_id')->where('day_index', $days[$day])->where('meetings.active', 1)->orderBy('meeting_time')->get(); $html = view('pdfs.meetings-by-day', array('meetings' => $meetings, 'day' => $day))->render(); $pdf = App::make('dompdf.wrapper'); return $pdf->loadHtml($html)->setPaper('A4', 'portrait')->download('lambda-' . strtolower($day) . '-schedule.pdf'); }); }); /** * API */
public function getActiveFellowships() { try { return Fellowship::where('active', 1)->get(); } catch (\Exception $e) { throw new LambdaException('The active fellowships could not be found', null, $e); } }