Esempio n. 1
0
 /**
  * Export the newcomers.
  *
  * @return string
  */
 public function getExportNewcomers()
 {
     $newcomers = Newcomer::select([\DB::raw('newcomers.first_name'), \DB::raw('newcomers.last_name'), \DB::raw('newcomers.branch')])->orderBy('last_name')->leftjoin('students as s', 's.student_id', '=', 'newcomers.referral_id')->addSelect([\DB::raw('s.first_name as referral_first_name'), \DB::raw('s.last_name as referral_last_name'), \DB::raw('s.email as referral_email'), \DB::raw('s.phone as referral_phone')])->get();
     return Excel::create('Newcomers', function ($file) use($newcomers) {
         $file->sheet('', function ($sheet) use($newcomers) {
             $sheet->fromArray($newcomers);
         });
     })->export('csv');
 }
Esempio n. 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')]);
 }