public function show($id)
 {
     // init
     $event = Events::with(array('city', 'eventcategory', 'user'))->where('id', '=', $id)->orderBy('id', 'desc')->first();
     $data = array('menu' => $this->_menu, 'title' => 'Event - ' . $event->name, 'description' => '', 'breadcrumb' => array('Event' => route('admin.event'), $event->name => route('admin.event.show', $event->id)));
     if ($event == null) {
         return App::abort('404');
     }
     $data['event'] = $event;
     $social_action = SocialActionEvent::with(array('user', 'socialAction'))->where('event_id', '=', $event['id'])->orderBy('id', 'desc')->get();
     // Get category
     // $data['social_actions'] = $social_action;
     $sos = array();
     if (count($social_action) > 0) {
         foreach ($social_action as $val) {
             # code...
             $sos[] = $val['social_action'];
         }
         $data['social_actions'] = $sos;
         // Get Photos that related with this
         $data['photos'] = Photo::where('type_name', '=', 'social_actions')->where('type_id', '=', $social_action[0]->id)->orderBy('id', 'desc')->get();
     } else {
         $data['social_actions'] = array();
         $data['photos'] = array();
     }
     return View::make('admin.pages.event.show')->with($data);
 }
예제 #2
0
 public function index()
 {
     // init
     $data = array();
     // set offset & limit
     $limit = 8;
     $page = Input::has('page') ? Input::get('page') : 1;
     $offset = ($page - 1) * $limit;
     // get all categories
     $data['categories'] = EventCategory::where('status', '=', 1)->get();
     // get all cities
     $data['cities'] = City::where('status', '=', 1)->orderBy('name', 'asc')->get();
     // get input
     $input = Input::all();
     // get social actions
     $events = Events::with(array('city', 'category'))->where('status', '!=', 0);
     if (Input::has('q')) {
         // keyword
         $input['q'] = trim($input['q']);
         $events = $events->where('name', 'like', '%' . $input['q'] . '%');
     }
     if (Input::has('category') and Input::get('category') != 'all') {
         // category
         $events = $events->where('event_category_id', '=', $input['category']);
     }
     if (Input::has('city') and Input::get('city') != 'all') {
         // city
         $events = $events->where('city_id', '=', $input['city']);
     }
     $data['events'] = $events->orderBy('ended_at', 'desc')->paginate($limit);
     // set input
     $data['input'] = $input;
     return View::make('bagikasih.event.index', $data);
 }
예제 #3
0
 public function index()
 {
     $blogs = Blog::with('author')->orderBy('created_at', 'desc')->take(10)->get();
     $events = Events::with('author')->orderBy('created_at', 'desc')->take(8)->get();
     $groups = Group::with('author')->orderBy('created_at', 'desc')->take(8)->get();
     $photos = Photo::with('author')->orderBy('created_at', 'desc')->take(8)->get();
     return View::make('home.index')->with('blogs', $blogs)->with('events', $events)->with('groups', $groups)->with('photos', $photos);
 }
 public function index()
 {
     // init
     $data = array('menu' => $this->_menu, 'title' => 'Dashboard', 'description' => '', 'breadcrumb' => array('Dashboard' => '/'));
     // New payment that need confirmation
     $data['payments'] = Payment::with(array('user', 'donations'))->where('status', '=', 0)->get();
     // New social target that need confirmation
     $data['social_targets'] = SocialTarget::with(array('city', 'category', 'user'))->where('status', '=', 0)->get();
     // New action action that need confirmation
     $data['social_actions'] = SocialAction::with(array('city', 'category', 'user'))->where('status', '=', 0)->get();
     // New event that need confirmation
     $data['events'] = Events::with(array('city', 'category', 'user'))->where('status', '=', 0)->get();
     // New report that need confirmation
     $reports = Report::with(array('user'))->where('have_responded', '=', 0)->get();
     foreach ($reports as $report) {
         $report->setAppends(array('type'));
     }
     $data['reports'] = $reports;
     // return $data;
     return View::make('admin.pages.dashboard')->with($data);
 }
예제 #5
0
 public function index()
 {
     $events = Events::with('author')->orderBy('created_at', 'desc')->paginate(20);
     return View::make('events.index')->with('events', $events);
 }