public function run() { DB::table('readings')->delete(); Reading::create(array('device' => 1, 'temp' => 19.5, 'heaton' => 1, 'created_at' => \Carbon\Carbon::now()->subDays(2)->toDateTimeString(), 'updated_at' => \Carbon\Carbon::now()->subDays(2)->toDateTimeString())); Reading::create(array('device' => 1, 'temp' => 19.7, 'heaton' => 1, 'created_at' => \Carbon\Carbon::now()->subDays(1)->toDateTimeString(), 'updated_at' => \Carbon\Carbon::now()->subDays(1)->toDateTimeString())); Reading::create(array('device' => 1, 'temp' => 20.1, 'heaton' => 0, 'created_at' => \Carbon\Carbon::now()->toDateTimeString(), 'updated_at' => \Carbon\Carbon::now()->toDateTimeString())); }
include ('views/regist_view.php'); }elseif($_GET['action']=='regist_act'){ $result=$users->getByLogin(strip_tags($_POST['login'])); if($result->num_rows==0){ $users->create(strip_tags($_POST['login']),strip_tags($_POST['pass'])); header('Location: '.base_url()); }else{ header('Location: '.base_url().'?action=regist_form&error=Такий логін вже використовується'); } }elseif($_GET['action']=='save'){ ini_set('display_errors', '1'); $rId = $reading->getByInf(urldecode($_GET['title']),urldecode($_GET['author']),$_COOKIE['id']); if($rId->num_rows>0){ $rUp = $reading->update($rId->fetch_object()->id,$_GET['line']); }else{ $qIns = $reading->create(urldecode($_GET['title']),urldecode($_GET['author']),$_COOKIE['id'],$_GET['line']); } }elseif($_GET['action']=='line'){ ob_get_clean(); $rId = $reading->getByInf(urldecode($_GET['title']),urldecode($_GET['author']),$_COOKIE['id']); if($rId->num_rows>0){ echo $rId->fetch_object()->line; }else{ echo '0'; } exit; } }else{ if(!isset($_COOKIE['id'])){ include ('views/author_view.php'); }else{
/** * Store a newly created resource in storage. * * @return Response */ public function store() { Reading::create(array('device' => Input::get('device'), 'temp' => Input::get('temp'), 'heaton' => Input::get('heaton'))); return Response::json(array('success' => true)); }