public function index()
 {
     if (Auth::guest()) {
         return view('pages.home');
     }
     //Check to make sure gender and names are populated
     $user = Auth::user();
     $fields = ['first_name' => $user->first_name, 'last_name' => $user->last_name, 'gender' => $user->gender];
     $validation = Validator::make($fields, User::$baseRules);
     if (!$validation->passes()) {
         return redirect('user/name-and-gender');
     }
     //Check to make sure user has choson categories
     if (!$this->categoryAccount->where('user_id', $user->id)->first()) {
         return redirect('user/categories');
     }
     $chosenCategories = $this->categoryAccount->where('user_id', Auth::user()->id)->orderByRaw('RAND()')->get();
     //Get one random task for the "one for the road"
     $oneForTheRoad = array();
     foreach ($chosenCategories as $category) {
         $events = $this->event->where('type', $category->category_id)->orderByRaw('RAND()')->get();
         foreach ($events as $event) {
             if (!$this->eventUser->where('event_id', $event->id)->where('user_id', Auth::user()->id)->first() && !$this->eventUser->where('user_id', Auth::user()->id)->where('created_at', '<=', date('Y-m-d 24:00:00'))->where('created_at', '>=', date('Y-m-d 00:00:00'))->where('complete', 1)->first()) {
                 array_push($oneForTheRoad, ['id' => $event->id, 'name' => $event->name, 'description' => $event->description, 'class' => 'active']);
             } else {
                 array_push($oneForTheRoad, ['id' => '0', 'name' => 'None for today!', 'description' => 'One for the road has completed', 'class' => 'inactive']);
             }
         }
     }
     $category = $this->category;
     return view('pages.dashboard', compact('category', 'chosenCategories', 'oneForTheRoad'));
 }
Example #2
0
 public function Home()
 {
     $flash = Event::where('start_date', '<=', new \Datetime())->where('end_date', '>=', new \Datetime())->orderBy('id', 'desc')->take(1)->get()->first();
     $articles = Article::where('id', '!=', isset($flash) ? $flash->article->id : 0)->orderBy('publish_at', 'desc')->orderBy('id', 'desc')->take(5)->get();
     $ffttNews = FFTTNew::orderBy('date', 'desc')->take(3)->get();
     return view('front.home', array('articles' => $articles, 'NewsFlash' => $flash, 'ffttNews' => $ffttNews));
 }
Example #3
0
 public function delete($id)
 {
     \App\Event::where('id', $id)->delete();
     \App\EventMedia::where('eventID', $id)->delete();
     \App\EventTag::where('eventID', $id)->delete();
     return redirect('/');
 }
 public function getCalendar()
 {
     $eventos = Event::select('titulo_evento')->where('user_id', '=', Auth::user()->id)->take(4)->get();
     //$datos['cTrabajo']= \DB::table('trabajo')->count();
     $array = Event::where('user_id', '=', Auth::user()->id)->get();
     return view('Calendar/calendar', compact('array', 'datos', 'eventos'));
 }
Example #5
0
 function postTask(Request $request)
 {
     $task = $request->all();
     Task::create($task);
     $comm = Committee::where('id', $task['comm_id'])->first();
     $evnt = Event::where('id', $comm['event_id'])->first();
     //UPDATING WEIGHT OF COMMITTEE AND EVENT
     $comm->increment('weight', $task['weight']);
     $evnt->increment('weight', $task['weight']);
     //UPDATING PROGRESS OF COMMITTEE
     $progress = 0;
     $tasks = Task::where('comm_id', $comm->id)->get();
     foreach ($tasks as $task1) {
         $progress += $task1->weight * $task1->progress;
     }
     $progress = $progress / $comm->weight;
     $comm->progress = $progress;
     $comm->save();
     //UPDATING PROGRESS OF EVENT
     $progress2 = 0;
     $committees = Committee::all();
     foreach ($committees as $committee) {
         if ($committee->event_id == $evnt->id) {
             $progress2 += $committee->weight * $committee->progress;
         }
     }
     $progress2 = $progress2 / $evnt->weight;
     $evnt->progress = $progress2;
     $evnt->save();
     return redirect('profile');
 }
 /**
  * Reverse the migrations.
  *
  * @return void
  */
 public function down()
 {
     $city = City::findByIATA('nyc')->first();
     $event = Event::where('city_id', '=', $city->id);
     $city->delete();
     $event->delete();
 }
Example #7
0
 /**
  * Render front page view
  * @return VIEW welcome
  */
 public function index()
 {
     $all_events = Event::where('time', '>', date('Y-m-d H:i:s'))->orderBy(DB::raw('RAND()'));
     $first_six = $all_events->take(6)->get();
     $next_six = $all_events->skip(6)->take(6)->get();
     return View::make('welcome')->with('first_six', $first_six)->with('next_six', $next_six);
 }
Example #8
0
 /**
  * Execute the console command.
  *
  * @return mixed
  */
 public function handle()
 {
     $cities = City::all();
     // Grab all the cities and then do a for each.
     // run this for each of them.
     foreach ($cities as $city) {
         $events = Event::where('city_id', '=', $city->id)->where('time_end', '>=', date('Y-m-d H:i:s'))->where('time_end', '<=', date('Y-m-d H:i:s', strtotime('+2 weeks')))->orderBy('time_start', 'asc')->get();
         if (!count($events)) {
             $this->comment('No events found for ' . $city->name . '. Mailer not sent.');
             continue;
         }
         $categories = Category::orderBy('title', 'asc')->get();
         if ($this->option('email')) {
             $subscriber = new Subscriber();
             $subscriber->name = 'Test User';
             $subscriber->email = $this->option('email');
             $subscribers = [$subscriber];
             $this->comment('Sent test email to ' . $this->option('email'));
         } else {
             $subscribers = Subscriber::where('city_id', '=', $city->id)->get();
         }
         $count = 0;
         foreach ($subscribers as $subscriber) {
             Mail::send('emails.subscribers.mailer', ['subscriber' => $subscriber, 'events' => $events, 'categories' => $categories, 'city' => $city], function ($m) use($subscriber, $city) {
                 $m->from('*****@*****.**', 'See+Do')->to($subscriber->email, $subscriber->name)->subject('Weekly Round-Up of Things to See+Do in ' . $city->name)->getHeaders()->addTextHeader('X-MC-Subaccount', 'see-do');
             });
             $count++;
         }
         $this->comment('Sent to ' . $count . ' email addresses in ' . $city->name . '.');
         $count = 0;
     }
 }
Example #9
0
 /**
  * Execute the job.
  *
  * @return void
  */
 public function handle()
 {
     // Same time next week! :D
     $job = (new \App\Jobs\WeeklyMail())->delay(604800);
     $this->dispatch($job);
     // We'll just want to double-check our Facebook events still exist
     // before we email people about them...
     FacebookSession::setDefaultApplication(getenv('FB_ID'), getenv('FB_SECRET'));
     $session = FacebookSession::newAppSession();
     try {
         $session->validate();
     } catch (FacebookRequestException $ex) {
         // Session not valid, Graph API returned an exception with the reason.
         dd($ex);
     } catch (\Exception $ex) {
         // Graph API returned info, but it may mismatch the current app or have expired.
         dd($ex);
     }
     $all_events = Event::where('time', '>', date('Y-m-d H:i:s'))->where('time', '<', date('Y-m-d H:i:s', time() + 604800))->get();
     foreach ($all_events as $event) {
         $request = new FacebookRequest($session, 'GET', "/" . $event->facebook_id);
         try {
             $response = $request->execute();
         } catch (\Exception $ex) {
             // Facebook Exception looking up event; probably deleted, should mirror here.
             $event->delete();
         }
     }
     foreach (User::where('unsubscribed_email', 'no') as $user) {
         $this->dispatch(new SendEmail($user));
     }
 }
Example #10
0
 /**
  * Edit timeline /
  */
 public function editTimeline($timeline_id, Request $request)
 {
     $timeline = \App\Timeline::where('id', '=', $timeline_id)->first();
     $timeline_events = $timeline->event()->orderBy('start_date')->get();
     if ($request->input('showForm') == 'true') {
         return view('timelines.editTimeline')->with('showForm', 'true')->with('timeline', $timeline)->with('timeline_events', $timeline_events);
     } else {
         // Else submit form
         // Validate the request data
         $this->validate($request, ['name' => 'required']);
         $user = \Auth::user();
         $timeline->name = $request->input('name');
         $timeline->description = $request->input('description');
         $timeline->last_modified_by = $user->id;
         $timeline->save();
         // Delete events
         for ($e = 0; $e < count($timeline_events); $e++) {
             if ($request->input('delete_event' . $e) == 'true') {
                 \DB::table('character_event')->where('event_id', '=', $timeline_events[$e]->id)->delete();
                 \DB::table('event_location')->where('event_id', '=', $timeline_events[$e]->id)->delete();
                 $event = \App\Event::where('id', '=', $timeline_events[$e]->id)->first();
                 if ($event) {
                     $event->delete();
                 }
             }
         }
         // Return success message
         return view('timelines.editTimeline')->with('showForm', 'false')->with('timeline', $timeline);
     }
 }
Example #11
0
 /**
  * Display the specified resource.
  *
  * @param  int  $id
  * @return \Illuminate\Http\Response
  */
 public function show($type, $id)
 {
     if ($id == 'video') {
         $events = Video::all();
         return view('video.show', compact('events'));
     } elseif ($id == 'staff') {
         $events = Staff::all();
         return view('staff.show', compact('events'));
     } elseif ($id == 'gallery') {
         $events = Image::all();
         return view('gallery.show', compact('events'));
     } else {
         $event = Event::where('slug', $id)->where('type', $type)->first();
         $location = Location::where('event_id', $event->id)->first();
         $slider = EventImage::where('event_id', $event->id)->orderBy(\DB::raw('RAND()'))->take(4)->get();
         $gallery = EventImage::where('event_id', $event->id)->first();
         if ($event->type == $type) {
             if ($event->status == 1) {
                 return view($type . '.show', compact('event', 'location', 'slider', 'gallery'));
             } else {
                 return redirect('/' . $type . '/');
             }
         }
     }
 }
 /**
  * Display a listing of the resource.
  *
  * @return \Illuminate\Http\Response
  */
 public function index()
 {
     $events = Event::where('user_id', $user_id)->get();
     $jobs = Job::where('user_id', $user_id)->get();
     // return view('members.dashboardpage', ['user' => $user, 'events' => $events, 'jobs' => $jobs]);
     return view('public.frontpage', ['user' => $user, 'events' => $events, 'jobs' => $jobs]);
 }
 /**
  * Handle an incoming request.
  *
  * @param  \Illuminate\Http\Request  $request
  * @param  \Closure  $next
  * @return mixed
  */
 public function handle($request, Closure $next)
 {
     $slug = $request->route('slug');
     $event = Event::where(['slug' => $slug])->first();
     //dd(\Auth::user()->role);
     $role = \Auth::user()->role;
     return $next($request);
 }
Example #14
0
 public function viewSingle($id)
 {
     if (!Event::where('id', $id)->exists()) {
         return redirect('/');
     }
     $event = Event::where('id', $id)->first();
     return view('single', compact('event', 'title', 'events'));
 }
 protected function tearDown()
 {
     PollResponse::where('pid', $this->pollOption->oid)->delete();
     PollOption::where('oid', $this->pollOption->oid)->delete();
     Poll::where('pid', $this->poll->pid)->delete();
     Event::where('eid', $this->event->eid)->delete();
     User::where('uid', $this->user->uid)->delete();
 }
Example #16
0
 /**
  * Display the specified resource.
  *
  * @param  int  $id
  * @return Response
  */
 public function show($id)
 {
     //Get the event with ID and online is 1
     $item = Event::where('online', 1)->findOrFail($id);
     //Add related pages also for this event
     $item['pages'] = $item->pages()->where('active', 1)->get();
     return $item;
 }
 /**
  * Display a listing of the resource.
  *
  * @return Response
  */
 public function getIndex()
 {
     //
     $events = Event::all();
     $upcoming = Event::where('event_date', '>', Carbon::now())->get();
     $past = Event::where('event_date', '<', Carbon::now())->get();
     return view('event.index', compact('upcoming', 'past'));
 }
 /**
  * Set test session variable to gain access to closed registration.
  */
 public function test($event_slug)
 {
     if ($event = Event::where('slug', $event_slug)->first()) {
         // set event session
         Session::set('event', $event);
         Session::set('test', true);
     }
     return redirect('/event/' . Session::get('event')->slug . '/start');
 }
 /**
  * Display report with limited details.
  */
 public function regional($event_slug, $key)
 {
     $event = Event::where('slug', $event_slug)->first();
     if ($event->getAccessToken('regional') == $key) {
         return view('report.regional', ['event' => $event]);
     } else {
         abort(404);
     }
 }
Example #20
0
 /**
  * Show the form for editing the specified resource.
  *
  * @param  int  $id
  * @return \Illuminate\Http\Response
  */
 public function edit($id)
 {
     try {
         $event = Event::where('priviledge', \Auth::user()->priviledge)->where('id', $id)->firstOrFail();
     } catch (\Illuminate\Database\Eloquent\ModelNotFoundException $e) {
         return view('errors.captureNotFound');
     }
     return view('event.show', compact('event'));
 }
 public function store()
 {
     $seven_days = 60 * 60 * 24 * 7;
     $two_hours = 60 * 60 * 2;
     $season = $_REQUEST['season'];
     $venue_id = $_REQUEST['venue_id'];
     $activity = $_REQUEST['activity'];
     $lastSeasonsLeague = League::where('season', $season - 1)->where('venue_id', $venue_id)->where('activity', $activity)->first();
     $lastSeasonsLastGame = Event::where('league_id', $lastSeasonsLeague->id)->where('week_num', 'Wild Card')->where('game_num', 1)->first();
     $start_dt = $_REQUEST['start_dt'];
     $start_dt = $start_dt ? strtotime($start_dt) : strtotime($lastSeasonsLastGame->date) + $seven_days;
     $start_wk = $_REQUEST['start_wk'];
     $start_wk -= 1;
     $week_cnt = $_REQUEST['week_cnt'];
     $game_cnt = $_REQUEST['game_cnt'];
     $games_tm = $_REQUEST['games_tm'];
     $games_tm = $games_tm ? strtotime($games_tm) : strtotime($lastSeasonsLastGame->time);
     $events = [];
     for ($i = $start_wk; $i <= $week_cnt; $i++) {
         $week_num = $i == $week_cnt ? 'Wild Card' : $i + 1;
         for ($j = 0; $j < $game_cnt; $j++) {
             $datetime = date('Y-m-d', $start_dt + $seven_days * $i) . ' ' . date('H:i:s', $games_tm + $two_hours * $j);
             $game_num = $j + 1;
             $league = League::where('season', $season)->where('venue_id', $venue_id)->where('activity', $activity)->first();
             if (!$league) {
                 $league = new League();
                 $league->season = $season;
                 $league->venue_id = $venue_id;
                 $league->activity = $activity;
                 $league->save();
             }
             $event = new Event();
             $event->league_id = $league->id;
             $event->season = $league->season;
             $event->venue_id = $league->venue_id;
             $event->datetime = $datetime;
             $event->week_num = $week_num;
             $event->game_num = $game_num;
             $event->activity = $league->activity;
             $events[] = $event;
         }
     }
     try {
         DB::transaction(function () use($events) {
             foreach ($events as $event) {
                 $event->save();
             }
         });
         $_SESSION['ALERT'] = alert('Season Added!', "Season {$season} for " . Venue::find($venue_id)->name . " was created successfully.", 'success');
     } catch (Excepton $e) {
         print_r($e);
         exit;
         $_SESSION['ALERT'] = alert('Season Not Added!', "Season {$season} for " . Venue::find($venue_id)->name . " could not be created.", 'error');
     }
     return redirect('/seasons');
 }
Example #22
0
 /**
  * Display a listing of the resource.
  *
  * @return Response
  */
 public function index()
 {
     $this->data['items'] = Event::where('enabled', 1)->first();
     $cek = Flag::where('eventid', $this->data['items']->id)->where('from', Auth::id())->where('to', Auth::id())->first();
     if ($cek != null) {
         $this->data['items'] = null;
         // dd($cek);
     }
     return view('pages.dept.dashboard', $this->data);
 }
 public function edit($id)
 {
     $category = $this->category->find($id);
     if ($category->archive == 1) {
         Event::where('archive', 0)->where('type', $category->id)->update(['archive' => 1, 'archived_through_category' => 1]);
     } else {
         Event::where('archive', 1)->where('type', $category->id)->where('archived_through_category', 1)->update(['archive' => 0, 'archived_through_category' => 0]);
     }
     return view('admin.pages.categories.edit', compact('category'));
 }
Example #24
0
function categoryMissingCrucialInformation($id)
{
    $category = \App\Category::find($id);
    if ($category->description > 0) {
        return false;
    }
    if (\App\Event::where('type', $category->id)->count() > 0) {
        return false;
    }
    return true;
}
Example #25
0
 public function readArticle($id, $titleSlugged)
 {
     $article = Article::find($id);
     if (str_slug($article->title) == $titleSlugged) {
         $mostRecentsNews = Article::where('id', '!=', $id)->orderBy('publish_at', 'desc')->orderBy('id', 'desc')->take(8)->get();
         $suggeredEvents = Event::where('start_date', '<=', new \Datetime())->where('end_date', '>=', new \Datetime())->orderBy('id', 'desc')->take(3)->get();
         return view('front.articles.read', array('article' => $article, 'mostRecentsNews' => $mostRecentsNews, 'suggeredEvents' => $suggeredEvents));
     } else {
         abort(404);
     }
 }
 public function deleteevent($id)
 {
     $dat = Event::where('id', '=', $id)->get();
     if (Auth::user()->privilege > 6 || $dat[0]->society_id == Auth::user()->id) {
         $data = Event::where('id', '=', $id);
         $data->delete();
         return Redirect::route('view_event')->with('message', 'Event Successfully Deleted');
     } else {
         return Redirect::route('dashboard')->with('error', "Access Denied");
     }
 }
Example #27
0
 /**
  * Gets the events for a society
  * @param  [type] $day [description]
  * @return [type]      [description]
  */
 public function eventsForSociety($society_identifier)
 {
     $society_identifier = str_replace("-", " ", $society_identifier);
     try {
         $society = Society::where('id', $society_identifier)->orWhere('facebook_ref', $society_identifier)->firstOrFail();
     } catch (\Exception $e) {
         abort(404);
     }
     $events = Event::where('time', '>', date('Y-m-d H:i:s', time()))->where('society_id', $society->id)->orderBy('time')->get();
     return ['society' => $society, 'events' => $events];
 }
Example #28
0
 public function showEventsUserForm(Request $request)
 {
     $this->middleware('auth');
     $user = $request->user;
     $daterange = $request->daterange;
     $dateStart = $request->dateStart;
     $dateEnd = $request->dateEnd;
     $events = Event::where('idUser', $user)->where('idUser', $user)->whereBetween('dateGps', [$dateStart, $dateEnd])->get();
     $users = User::all();
     return view('app.event.user')->with('user', $user)->with('events', $events)->with('users', $users);
 }
Example #29
0
 protected function tearDown()
 {
     if (is_null($this->lastEvent)) {
         $event = Event::first();
         if (!is_null($event)) {
             $event->delete();
         }
     } else {
         Event::where('eid', '>', $this->lastEvent)->delete();
     }
     User::where('uid', $this->user->uid)->delete();
 }
 public function getHome()
 {
     $year = date("Y");
     $varr = Auth::user()->empid;
     $evarr = User::where('empid', $varr)->get();
     $edetails = Employee::where('emp_ide_id', $varr)->get();
     $categories = Event::where(DB::raw('year(date)'), $year)->get();
     $employee = Employee::all();
     $invoice = Invoice::orderBy('Id', 'DESC')->where(DB::raw('year(InvoiceDate)'), $year)->where(DB::raw('year(DueDate)'), $year)->get();
     $invnull = Invoice::where('Status', '=', 'Null')->get();
     return View('reviewer/home')->with(array('categories' => $categories, 'employee' => $employee, 'invoice' => $invoice, 'invnull' => $invnull, 'edetails' => $edetails));
 }