/** * Create a new controller instance. * * @return void */ public function __construct(Request $r) { date_default_timezone_set("Asia/Jakarta"); //$this->middleware('auth'); //echo "<pre>".print_r($_SERVER,1)."</pre>"; $log = new Logdata(); $log->idpengguna = Auth::check() ? Auth::user()->id : 0; $log->url = $r->url(); $log->user_agent = $_SERVER['HTTP_USER_AGENT']; $log->ip = $_SERVER['REMOTE_ADDR']; $log->ip_port = isset($_SERVER['REMOTE_PORT']) ? $_SERVER['REMOTE_PORT'] : ""; $log->http_host = isset($_SERVER['HTTP_HOST']) ? $_SERVER['HTTP_HOST'] : ""; $log->http_referer = isset($_SERVER['HTTP_REFERER']) ? $_SERVER['HTTP_REFERER'] : ""; $log->pathinfo = isset($_SERVER['REQUEST_URI']) ? $_SERVER['REQUEST_URI'] : ""; $log->save(); // echo Auth::user()->password; // if(Auth::check()){ // if(Auth::user()->password==""){ // header("location:".url('notfound')); // die(); // } // } // Session::put("a-".getenv('REMOTE_ADDR')."-3",'x'); foreach (\App\Popups::all() as $key) { $isi = array(); if ($key->tipe_valid == "by_datetime" or $key->tipe_valid == "by_date") { $cek = $this->check_in_range(date_format(date_create($key->date_valid_start . " " . $key->time_valid_start), "Y-m-d H:i:s"), date_format(date_create($key->date_valid_end . " " . $key->time_valid_end), "Y-m-d H:i:s"), date("Y-m-d H:i:s")); if ($cek) { if (!Session::has("a-" . getenv('REMOTE_ADDR') . "-" . $key->id)) { Session::put("a-" . getenv('REMOTE_ADDR') . "-" . $key->id, 'x'); } } } } }
/** * Remove the specified resource from storage. * * @param int $id * @return Response */ public function destroy($id) { $a = \App\Popups::find($id); $a->delete(); return redirect(url('admin/popups')); }