/**
  * Shows the homepage.
  *
  * @return \Illuminate\Http\Response
  */
 public function welcome()
 {
     //Gets a list of all events in a random order.
     $randEvent = Event::orderBy(DB::raw('RAND()'))->get();
     //returns the welcome view with the array of events from above.
     return view('welcome', ['randEvent' => $randEvent]);
 }
 public function store(Request $request)
 {
     // Add new event
     $event = new Event();
     $event->name = $request->input('name');
     $event->date = $request->input('date');
     $this->selectVenue($request->input('venue'), $event);
     $event->save();
     //generate the filename
     $file_name = strtolower($event->id . '-' . $event->venue->slug . '-' . date_format($event->date, 'd-m-y'));
     // move the file
     if ($request->file('image')) {
         // resize and save
         $image = Image::make($request->file('image'));
         $image->resize(300, null, function ($constraint) {
             $constraint->aspectRatio();
         })->save(base_path() . '/public/img/posters/tn_' . $file_name);
         // save full sized also
         $request->file('image')->move(base_path() . '/public/img/posters/', $file_name);
     }
     // reselect the event..
     $event = Event::orderBy('created_at', 'desc')->first();
     if ($request->file('image')) {
         // add the image and save it
         $event->image = $file_name;
     }
     $event->save();
     if (isset($request['bands'])) {
         foreach ($request['bands'] as $band) {
             $band = Band::where('name', $band)->first();
             $event->band()->attach($band->id);
         }
     }
     return redirect()->back();
 }
 public function index()
 {
     // Retrieve all events from the database
     // and order by earliest starting first
     $events = Event::orderBy('start_datetime', 'ASC')->get();
     //return the view of all events
     return view('events.index', ['events' => $events]);
 }
 public function dashboard()
 {
     $venues = Venue::orderBy('name', 'asc')->get();
     $bands = Band::orderBy('name', 'asc')->get();
     $events = Event::orderBy('date', 'asc')->get();
     $events_future = Event::futureEvents();
     $events_past = Event::pastEvents();
     return view('dashboard', compact('venues', 'events', 'events_future', 'events_past', 'bands'));
 }
Exemple #5
0
 public function agenda()
 {
     $events = Event::orderBy('endtime')->get();
     $pastevents = $events->filter(function ($item) {
         return $item->starttime->isPast();
     });
     $futureevents = $events->filter(function ($item) {
         return $item->starttime->isFuture();
     });
     return view('pages.public.agenda', compact('pastevents', 'futureevents', 'events'));
 }
 /**
  * Show the admin dashboard.
  *
  * @return \Illuminate\Http\Response
  */
 public function index()
 {
     //Gets all the event details from the event table
     $events = Event::orderBy('created_at', 'desc')->paginate(5, ['*'], 'events');
     $pastevents = Event::onlyTrashed()->orderBy('deleted_at', 'desc')->paginate(5, ['*'], 'past');
     //gets all messages from the messages table
     $messages = Message::join('users', 'users.id', '=', 'messages.userid')->select('users.name', 'users.email', 'messages.*')->whereNull('deleted_at')->orderBy('created_at', 'desc')->paginate(5, ['*'], 'messages');
     //gets all the read (deleted) messages from the messags table.
     $readMessages = Message::join('users', 'users.id', '=', 'messages.userid')->select('users.name', 'users.email', 'messages.*')->whereNotNull('deleted_at')->onlyTrashed()->orderBy('created_at', 'desc')->paginate(5, ['*'], 'read');
     //Returns the events view along with the $events, $messages and $readMessages arrays containing the query results from above
     return view('admin/admin', ['events' => $events, 'pastevents' => $pastevents, 'messages' => $messages, 'readMessages' => $readMessages]);
 }
 public function index(Request $request)
 {
     if (!Auth::check()) {
         return response()->json($this->notLoginJson, 401);
     } else {
         $user = Auth::user();
         if (!$user->hasRole('user')) {
             return response()->json($this->needPermissionsJson, 401);
         }
     }
     $events = Event::orderBy('date', 'desc')->get();
     foreach ($events as $event) {
         $event->load('members');
         $event->loadResources();
     }
     return response()->json($events);
 }
Exemple #8
0
 public function update(Request $request, $id)
 {
     if ($request->isMethod('get')) {
         $this->data['items'] = Event::orderBy('created_at', 'asc')->get();
         $this->data['questions'] = Question::get();
         $this->data['lala'] = Event::find($id);
         if ($this->data['lala']) {
             return view('pages.event.update', $this->data);
         } else {
             return redirect('event');
         }
     } elseif ($request->isMethod('post')) {
         $event = Event::find($id);
         $event->update($request->all());
         $event->question()->detach();
         if (isset($request->all()['questions'])) {
             $event->question()->sync($request->all()['questions']);
         }
         return redirect('event/detail/' . $id);
     }
 }
 /**
  * Display a listing of the resource.
  *
  * @return Response
  */
 public function adminIndex()
 {
     $events = Event::orderBy('name')->with('bands', 'manager', 'article')->paginate(15);
     return view('admin.events.index', compact('events'));
 }
Exemple #10
0
 /**
  * Display a listing of the resource.
  *
  * @return Response
  */
 public function index()
 {
     $events = Event::orderBy('id', 'DESC')->get();
     return view('events.index', compact('events'));
 }
Exemple #11
0
 public function index()
 {
     $events = Event::orderBy('event_time')->upcoming()->get();
     return view('events.all', compact('events'));
 }
 /**
  * Display a listing of the resource.
  *
  * @return Response
  */
 public function index()
 {
     //Find the events
     $events = Event::orderBy('date', 'asc')->get();
     return view('admin.event.index', compact('events'));
 }
Exemple #13
0
 /**
  * Show the application dashboard to the user.
  *
  * @return Response
  */
 public function index()
 {
     $events = Event::orderBy('when', 'asc')->get();
     return view('home', compact('events'));
 }
Exemple #14
0
 public function index()
 {
     //
     $events = Event::orderBy('created_at', 'DESC')->paginate(20);
     return view('admin.event.index', compact('events'));
 }
Exemple #15
0
 public function homepage()
 {
     $events = Event::orderBy('event_time')->get();
     return View::make('home', compact('events'));
 }
Exemple #16
0
 /**
  * Display a listing of the resource.
  *
  * @return Response
  */
 public function index()
 {
     $events = Event::orderBy('endtime')->get();
     return view('pages.admin.events.index', compact('events'));
 }
 /**
  * All events archived
  *
  * @return view
  **/
 public function archive()
 {
     $events = Event::orderBy('created_at', 'desc')->paginate(10);
     //dd($events);
     return view('dashboard.events.archive', compact('events'));
 }
 /**
  * Display a listing of the resource.
  *
  * @return \Illuminate\Http\Response
  */
 public function index()
 {
     $data = ['page_title' => 'Events', 'events' => Event::orderBy('start_time')->get()];
     return view('event/list', $data);
 }
 /**
  * Display a listing of the resource.
  *
  * @return Response
  */
 public function index()
 {
     $events = Event::orderBy('id', 'desc')->paginate(10);
     return view('events.index', compact('events'));
 }
Exemple #20
0
 /**
  * Display a listing of the resource.
  *
  * @return \Illuminate\Http\Response
  */
 public function index()
 {
     $event = new Event();
     $events = $event->orderBy('name')->get();
     return view('dashboard/events')->with('events', $events)->with('event', new Event());
 }