/**
  * Display a listing of the resource.
  *
  * @param FellowshipTransformer $transformer
  * @param null $fellowshipId
  * @param MeetingsRepository $repo
  * @return \Illuminate\Http\Response
  * @internal param null $id
  */
 public function index(FellowshipTransformer $transformer, MeetingsRepository $repo, $fellowshipId = null)
 {
     $meetings = $fellowshipId ? $repo->getMeetingsByFellowship($fellowshipId) : Fellowship::where('active', 1)->orderBy('fellowship', 'ASC')->get();
     if (!empty($fellowshipId)) {
         header("Access-Control-Allow-Origin: *");
         return response()->json(['data' => $meetings], 200, $this->getHeaders());
     } else {
         return $this->respond(['data' => $transformer->transformCollection($meetings->toArray())]);
     }
 }
Ejemplo n.º 2
0
 public function getFellowshipName($fellowship)
 {
     return Fellowship::where('abbreviation', $fellowship)->first();
 }
Ejemplo n.º 3
0
     * 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
 */
Ejemplo n.º 4
0
 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);
     }
 }