/**
  * Store a newly created resource in storage.
  *
  * @return Response
  */
 public function store_lotteries(Lottery $lottery, Request $request)
 {
     $this->validate($request, $this->rules);
     $input = Input::all();
     if (strlen($input['hh']) === 1 && intval($input['hh']) < 10) {
         $input['hh'] = "0" . $input['hh'];
     }
     if (strlen($input['mm']) === 1 && intval($input['mm']) < 10) {
         $input['mm'] = "0" . $input['mm'];
     }
     if ($input['ampm'] === 'PM' && intval($input['hh']) >= 1 && intval($input['hh']) < 12) {
         $input['hh'] = intval($input['hh']) + 12;
     } else {
         if ($input['ampm'] === 'AM' && intval($input['hh']) === 12) {
             $input['hh'] = '00';
         }
     }
     $time = $input['hh'] . $input['mm'];
     $input['draw_time'] = $time;
     // dd($input);
     if (!empty($input['id'])) {
         $lottery = Lottery::find((int) $input['id']);
     } else {
         $lottery = new Lottery();
     }
     $lottery->name = $input['name'];
     $lottery->draw_time = $time;
     $lottery->save();
     $lotteries = Lottery::all();
     $is_admin = true;
     return view('lotteries.manage', compact('lotteries', 'is_admin'));
 }