Пример #1
0
 public static function getYearFoEssai($user, $date)
 {
     $old = Carbon::parse($date)->diff(Carbon::now())->format('%y');
     $cat = CategoryBill::where('user_id', $user->id)->get();
     foreach ($cat as $c) {
         if ($old >= $c->age_de && $old <= $c->age_a) {
             return $c->prix;
         }
     }
 }
Пример #2
0
 public function getage()
 {
     if (\Request::ajax()) {
         $input = Input::get('inputd');
         $years = Carbon::parse($input)->diffInYears(Carbon::now());
         $cats = CategoryBill::where('user_id', \Auth::user()->id)->get();
         foreach ($cats as $cat) {
             if ($years >= $cat->age_de && $years <= $cat->age_a) {
                 echo "Cet Elève de " . $years . " Ans Va payer " . $cat->prix . ' Dhs';
                 break;
             }
         }
     }
 }
Пример #3
0
 public function show_cat_bills()
 {
     if (\Request::ajax()) {
         $cat = Input::get('cat');
         $check = CategoryBill::where('user_id', \Auth::user()->id)->where('name', $cat)->get();
         if (!$check->isEmpty()) {
             foreach ($check as $c) {
                 echo json_encode($c);
                 die;
             }
         } else {
             $tab = ['age_de' => 0, 'age_a' => 0, 'prix' => 0];
             echo json_encode($tab);
             die;
         }
     }
 }