예제 #1
0
 /**
  * Export the teams and CE into a CSV file.
  *
  * @return string
  */
 public function getExportTeams()
 {
     $students = Student::select(['first_name', 'last_name', 'phone', 'email', 'team_id'])->orderBy('last_name')->where('ce', 1)->whereNotNull('team_id')->where('team_accepted', 1)->join('teams as t', 't.id', '=', 'students.team_id')->addSelect(\DB::raw('t.name as team_name'))->get();
     return Excel::create('Teams', function ($file) use($students) {
         $file->sheet('', function ($sheet) use($students) {
             $sheet->fromArray($students);
         });
     })->export('csv');
 }
예제 #2
0
 /**
  *
  * @return Response
  */
 public function list()
 {
     // Find students
     $students = Student::select([DB::raw('student_id AS id'), 'first_name', 'last_name', 'phone', DB::raw('1 AS student'), DB::raw('1 AS parent_authorization'), 'wei_payment', 'sandwich_payment', 'guarantee_payment', DB::raw('(ce AND team_accepted) AS ce'), 'volunteer', 'orga', 'wei_validated'])->where('wei', 1)->with('weiPayment')->with('sandwichPayment')->with('guaranteePayment');
     // Find newcomers
     $newcomer = Newcomer::select(['id', 'first_name', 'last_name', 'phone', DB::raw('0 AS student'), 'parent_authorization', 'wei_payment', 'sandwich_payment', 'guarantee_payment', DB::raw('0 AS ce'), DB::raw('0 AS volunteer'), DB::raw('0 AS orga'), DB::raw('1 AS wei_validated')])->where('wei', 1)->with('weiPayment')->with('sandwichPayment')->with('guaranteePayment');
     // Union between newcomers and students
     $users = $students->union($newcomer)->orderBy('last_name')->get();
     return View::make('dashboard.wei.list', ['users' => $users]);
 }
 public function prematch()
 {
     return View::make('dashboard.referrals.prematch', ['referralCountries' => Student::select('country')->where(['referral' => 1, 'referral_validated' => 1])->groupBy('country')->lists('country'), 'newcomerCountries' => Newcomer::select('country')->groupBy('country')->lists('country'), 'referralBranches' => Student::select('branch')->where(['referral' => 1, 'referral_validated' => 1])->groupBy('branch')->lists('branch'), 'newcomerBranches' => Newcomer::select('branch')->groupBy('branch')->lists('branch')]);
 }