/**
  * Show the application welcome screen to the user.
  *
  * @return Response
  */
 public function index()
 {
     $events = Event::take('4')->get();
     $authors = Author::take('4')->get();
     $coverage = DB::table('press')->take('4')->orderBy('press_date', 'desc')->get();
     return view('welcome', compact('events', 'authors', 'coverage'));
 }
Esempio n. 2
0
 /**
  * Show the application dashboard.
  *
  * @return Response
  */
 public function index()
 {
     try {
         $isInstalled = Setting::where('name', 'is_installed')->firstOrFail();
     } catch (ModelNotFoundException $e) {
         $isInstalled = Setting::create(['name' => 'is_installed', 'setting' => 'no']);
     }
     if ($isInstalled->setting != 'yes') {
         return Redirect::route('install');
     }
     $data = ["event" => Event::first(), "upcomingEvents" => Event::take(3)->get(), "news" => News::take(6)->get(), "media" => Media::where('processed', true)->orderBy('id', 'DESC')->take(12)->get()];
     return view('home')->with($data);
 }
Esempio n. 3
0
 public function scanIsInsideParcel()
 {
     $this->middleware('auth');
     $pointLocation = new PointLocation();
     $events = Event::take(1000)->orderBy('dateGps', 'ASC')->get();
     foreach ($events as $key => $value) {
         $latLonEvent = $value->lat . "," . $value->lon;
         $event = $value;
         $parcels = Parcel::orderByRaw('lat - ' . $value->lat . '', 'ASC')->take(20)->get();
         foreach ($parcels as $key => $value) {
             $isPointInside = 0;
             $parcelsGps = ParcelGps::where('idparcel', $value->id)->orderBy('number', 'ASC')->get();
             $polygon = array();
             foreach ($parcelsGps as $key => $value) {
                 $latlng = "" . $value->lat . ", " . $value->long . "";
                 $idparcelEvent = $value->idparcel;
                 array_push($polygon, $latlng);
             }
             $isPointInside = $pointLocation->pointInPolygon($latLonEvent, $polygon, $event, $idparcelEvent);
             if ($isPointInside == 1) {
                 $event = Event::find($event->id);
                 $event->isSync = 1;
                 $event->isInside = 1;
                 $event->idParcelle = $idparcelEvent;
                 $event->save();
                 $eventprocessed = new ProcessedEvents();
                 $eventprocessed->idApp = $event->idApp;
                 $eventprocessed->idUser = $event->idUser;
                 $eventprocessed->name = $event->name;
                 $eventprocessed->lon = $event->lon;
                 $eventprocessed->lat = $event->lat;
                 $eventprocessed->dateGps = $event->dateGps;
                 $eventprocessed->timeDate = $event->timeDate;
                 $eventprocessed->isInside = $event->isInside;
                 $eventprocessed->idParcelle = $event->idParcelle;
                 $eventprocessed->altitude = $event->altitude;
                 $eventprocessed->isSync = $event->isSync;
                 $eventprocessed->save();
                 break;
             }
             if ($isPointInside == 0) {
                 $event = Event::find($event->id);
                 $event->isSync = 1;
                 $event->isInside = 0;
                 $event->idParcelle = 0;
                 $event->save();
             }
         }
     }
 }
Esempio n. 4
0
 public function showParcelsEvents()
 {
     $events = Event::take(100)->get();
     $users = User::all();
     $parcels = Parcel::all();
     $parcelsGpsArray = [];
     foreach ($parcels as $key => $value) {
         $parcelsGps = ParcelGps::where('idparcel', $value->id)->orderBy('number')->select('lat', 'long')->get();
         array_push($parcelsGpsArray, $parcelsGps);
     }
     // load the view and pass the parcels
     return View::make('app.parcel.showevent')->with('parcels', $parcelsGpsArray)->with('events', $events)->with('users', $users);
 }
Esempio n. 5
0
 public function getListEvents()
 {
     $events = Event::take(2);
     return $events;
 }