コード例 #1
0
 public function addTimerAction()
 {
     $rules = array('itemID' => 'required', 'structureType' => 'required', 'timerType' => 'required', 'days' => 'required', 'hours' => 'required', 'mins' => 'required');
     $validator = Validator::make(Input::all(), $rules);
     if ($validator->fails()) {
         return Redirect::route('add_timer')->with('flash_error', 'Please fill in all Timer Information')->withInput();
     } else {
         $time = Carbon::now()->addDays((int) Input::get('days'))->addHours((int) Input::get('hours'))->addMinutes((int) Input::get('mins'));
         // DO REGISTRATION
         Timers::create(array('itemID' => Input::get('itemID'), 'structureType' => (int) Input::get('structureType'), 'structureStatus' => (int) Input::get('structureStatus'), 'timeExiting' => date('Y-m-d H:i:s', $time->timestamp), 'bashed' => '0', 'timerType' => Input::get('timerType'), 'outcome' => '0', 'user_id' => Auth::user()->id));
         return Redirect::route('home')->with('flash_msg', 'New Timer Added');
     }
 }
コード例 #2
0
 public function run()
 {
     DB::table('timers')->delete();
     Timers::create(array('itemID' => '40228414', 'bashed' => 0, 'outcome' => 0, 'structureType' => 0, 'structureStatus' => 0, 'timerType' => 0, 'timeExiting' => date('Y-m-d H:i:s', 1387366200), 'user_id' => '1', 'type' => '0'));
 }