Example #1
0
 static function InsertNewClassFromFranchise($data)
 {
     $insert = new classes();
     $insert->class_name = $data['className'];
     $getSlug = ClassesMaster::select('slug', 'id')->where('class_name', '=', $data['className'])->get();
     //return $getSlug[0]['slug'];
     $insert->slug = $getSlug[0]['slug'];
     $insert->base_price_no = $data['basePriceNo'];
     $insert->course_id = $data['Course_id'];
     $insert->franchisee_id = Session::get('franchiseId');
     $insert->class_master_id = $getSlug[0]['id'];
     $insert->created_by = Session::get('userId');
     $insert->updated_by = Session::get('userId');
     $insert->save();
     return $insert;
 }
Example #2
0
 public function eligibleClassessForOtherBatches()
 {
     $inputs = Input::all();
     $ageYearForBatch2 = date_diff(date_create(date('Y-m-d', strtotime($inputs['studentDob']))), date_create($inputs['FutureAgeDate']))->y;
     $ageMonthForBatch2 = date_diff(date_create(date('Y-m-d', strtotime($inputs['studentDob']))), date_create($inputs['FutureAgeDate']))->m;
     $yearAndMonthForBatch2 = $ageYearForBatch2 * 12 + $ageMonthForBatch2;
     if ($yearAndMonthForBatch2 >= 4) {
         $classesMaster = ClassesMaster::select('id')->where("class_start_age", "<=", $yearAndMonthForBatch2)->where("class_end_age", ">=", $yearAndMonthForBatch2)->where("age_start_limit_unit", "=", "months")->where("age_end_limit_unit", "=", "months")->get();
     }
     $masterClassIDs = array();
     $i = 0;
     foreach ($classesMaster->toArray() as $masterClass) {
         $masterClassIDs[$i] = $masterClass['id'];
         $i++;
     }
     $classesEligible = DB::table('classes')->whereIn('class_master_id', $masterClassIDs)->where('franchisee_id', '=', Session::get('franchiseId'))->get();
     header('Access-Control-Allow-Origin: *');
     return Response::json($classesEligible);
 }