Пример #1
0
 public function insertDb()
 {
     $visitor = new Visitor();
     $visitor->ip = $this->ip;
     $visitor->browser = $this->browser;
     $visitor->position = $this->position;
     $visitor->save();
 }
Пример #2
0
 public function postRegister(Request $request)
 {
     //验证
     $this->validate($request, ['username' => 'required|max:255|unique:visitors', 'password' => 'required|min:6', 'email' => 'required|email|max:255|unique:visitors']);
     $visitor = new Visitor();
     $visitor->username = $request->input('username');
     $visitor->password = bcrypt($request->input('password'));
     $visitor->email = $request->input('email');
     $visitor->phone = $request->input('phone');
     $visitor->save();
     return redirect('auth/login');
     //return redirect($this->redirectPath('auth/login'))->with($this->statusVar, Lang::get('auth.addUserSuccess'));
 }
Пример #3
0
 public function visitor($id, $key)
 {
     if ($key == Visitor::where("project_id", $id)->get()->first()->Key) {
         $userstories = DB::table('userstory')->where('project_id', $id)->get();
         return view("Backlog")->with('userstories', $userstories)->with('idProject', $id);
     }
 }
Пример #4
0
 /**
  * Display a listing of the resource.
  *@param Request $request
  * @return Response
  */
 public function getIndex(Request $request)
 {
     $mod = Visitor::orderBy('created_at', 'desc');
     $this->visitorSearch($mod, $request);
     $visitors = $mod->paginate(15);
     $this->assign('visitors', $visitors);
     return $this->display('admin.visitor.index');
 }
Пример #5
0
 public function forbid($project_id)
 {
     $key = Visitor::where("project_id", $project_id)->get()->first();
     if ($key != null) {
         DB::table('visitor')->where('project_id', $project_id)->delete();
     }
     $key = Visitor::where("project_id", $project_id)->get()->first();
     return redirect()->action("VisitorController@show", [$project_id]);
 }
Пример #6
0
 public function __construct(\Illuminate\Http\Request $request)
 {
     $key = $request->route()->key;
     $idProject = $request->route()->idProject;
     if ($key != null) {
         if (Visitor::where("Key", $key)->where("project_id", $idProject)->get()->first() == null) {
             $this->middleware('auth');
         }
     } else {
         $this->middleware('auth');
     }
 }
 /**
  * Store a newly created resource in storage.
  *
  * @param  Request  $request
  * @return Response
  */
 public function store(Request $request)
 {
     //$validator  = $this->validate($request, [
     //                'name' => 'required',
     //                'email' => 'required|email',
     //                'address' => 'required',
     //                'city' => 'required',
     //                'zipcode' => 'required',
     //            ]);
     $validator = Validator::make($request->all(), ['first_name' => 'required', 'last_name' => 'required', 'email' => 'required|email|unique:visitors', 'address' => 'required', 'city' => 'required', 'zipcode' => 'required']);
     if ($validator->fails()) {
         $messages = $validator->messages();
         return redirect()->action('splashsController@index')->withErrors($validator)->withInput();
     } else {
         $visitor = new Visitor();
         $visitor->fill($request->except('_token'));
         $visitor->status = 'Active';
         $visitor->save();
         return redirect()->action('splashsController@index')->with('message', 'Thank you for your request!');
     }
 }
Пример #8
0
 public function index(Request $request)
 {
     if ($request->get('startDate') && $request->get('endDate')) {
         $start = $request->get('startDate');
         $end = $request->get('endDate');
         $visitor = Visitor::select(DB::raw('DATE(created_at) as date'), DB::raw('count(*) as total'))->whereBetween(DB::raw('DATE(created_at)'), [$start, $end])->groupby(DB::raw('DATE(created_at)'))->get();
     } else {
         $visitor = Visitor::select(DB::raw('DATE(created_at) as date'), DB::raw('count(*) as total'))->where("created_at", "like", $this->year . "%")->groupby(DB::raw('DATE(created_at)'))->get();
     }
     //dd(date('Y-m-d', strtotime($user->created_at)));
     return view('admin.dashboard.index', compact(['visitor', 'count_visitor']));
 }
Пример #9
0
 public function show($project_id, $sprint_id, $key = null)
 {
     if ($key != null) {
         if (Visitor::where("key", $key)->where("project_id", $project_id)->get() != null) {
             $todos = DB::table('userstory')->where("tache.Status", 0)->join('tache', 'tache.us_story_id', '=', 'userstory.id')->where('userstory.sprint_id', $sprint_id)->where('userstory.project_id', $project_id)->get();
             $goings = DB::table('userstory')->where("tache.Status", 1)->join('tache', 'tache.us_story_id', '=', 'userstory.id')->where('userstory.sprint_id', $sprint_id)->where('userstory.project_id', $project_id)->get();
             $dones = DB::table('userstory')->where("tache.Status", 2)->join('tache', 'tache.us_story_id', '=', 'userstory.id')->where('userstory.sprint_id', $sprint_id)->where('userstory.project_id', $project_id)->get();
             return view("kanban.show")->with('todos', $todos)->with('ongoings', $goings)->with('dones', $dones);
         }
     }
     return Redirect()->action('Auth\\AuthController@getLogin');
 }
Пример #10
0
 /**
  * [updateVisitor description]
  * @param  [type] $cvuid [description]
  * @return [type]        [description]
  */
 public function updateVisitor($cvuid)
 {
     // TODO
     //
     // Fixa bättre kakhantering. Just nu lagras id i klartext i javascriptvariabel.
     // Hämta istället den krypterade kakan som innehåller user id.
     //
     //
     $v = Visitor::where('session', $cvuid)->first();
     $v->touch();
     $dn = date('Y-m-d H:i:s', time() - 10);
     $v2 = Visitor::where('updated_at', '<', $dn)->delete();
     $count = Visitor::all()->count();
     return $count;
 }
Пример #11
0
 public function __construct($widget_id)
 {
     // Find or fail widget
     $this->widget = Widget::findOrFail($widget_id);
     $session_id = Session::getId();
     $referrer = filter_var(Request::server('HTTP_REFERER'), FILTER_SANITIZE_URL);
     // Add new resource?
     $this->resource = Resource::firstOrNew(['uri' => $referrer, 'widget_id' => $this->widget->id]);
     $this->resource->uri = $referrer;
     $this->resource->widget_id = $this->widget->id;
     $this->resource->save();
     // Add new visitor?
     $this->visitor = Visitor::firstOrCreate(['session_id' => $session_id]);
     $this->visitor->touch();
     // Add new view?
     $this->view = View::firstOrCreate(['resource_id' => $this->resource->id, 'visitor_id' => $this->visitor->id]);
     $this->view->touch();
 }
Пример #12
0
 public function statuschange($data)
 {
     $v_data = json_decode($data, true);
     $id = $v_data['id'];
     $status = $v_data['status'];
     $visitor = Visitor::findOrFail($id);
     $visitor->status = $status;
     if ($status == 0) {
         $visitor->departure_time = date('d-m-Y H:i:s');
     } else {
         $visitor->departure_time = '0000-00-00 00:00:00';
         $visitor->arival_date = date('d-m-Y');
         $visitor->arival_timestamp = strtotime(date('d-m-Y'));
         $visitor->arival_time = date('H:i');
     }
     if ($visitor->save()) {
         return Response::json(array('success' => 'Status changed!'));
     }
 }
Пример #13
0
 public function store($input)
 {
     return Visitor::firstOrCreate($input);
 }
Пример #14
0
 public function show()
 {
     $chartDatas = Visitor::select([DB::raw('DATE(created_at) AS date'), DB::raw('COUNT(id) AS count')])->whereBetween('created_at', [Carbon::now()->subDays(30), Carbon::now()])->groupBy('date')->orderBy('date', 'ASC')->get()->toArray();
     return view('admin.visitors.show', compact('chartDatas'))->with(['title' => 'visitors Diagram']);
 }
Пример #15
0
 /**
  * Reports Handlers...
  *
  */
 public function reports()
 {
     $visitors = Visitor::all();
     return Response::json(array('visitors' => $visitors));
 }
Пример #16
0
 /**
  * Show the dashboard page
  *
  * @param Guard $auth
  *
  * @return \Illuminate\Contracts\View\Factory|\Illuminate\View\View
  */
 public function dashboard(Guard $auth)
 {
     return view('dashboard', ['user' => $auth->user(), 'recentVisitors' => Visitor::countRecent()]);
 }