public function getSession($id)
 {
     $data = array();
     $social_actions = SocialAction::with('socialTarget', 'user')->where('id', $id)->first();
     if ($social_actions == false) {
         return App::abort('404');
     }
     $photos = Photo::where('type_name', '=', 'social_actions')->where('type_id', '=', $social_actions->id)->where('status', '=', 1)->get();
     $donations = Donation::with(array('user'))->where('type_name', '=', 'social_actions')->where('type_id', '=', $social_actions->id)->where('status', '=', 1)->orderBy('id', 'desc')->get();
     $user = User::getUserId($social_actions->user_id);
     $social_target_id = SocialTarget::getAll();
     $social_action_category_id = SocialActionCategory::getAll();
     $city_id = City::getAll();
     $data = array('social_action' => $social_actions, 'photos' => $photos, 'donations' => $donations, 'user' => $user, 'social_target_id' => $social_target_id, 'social_action_category_id' => $social_action_category_id, 'city_id' => $city_id);
     Session::put('type_name', 'SocialAction');
     Session::put('type_id', $social_actions->social_target_id);
     return Redirect::route('buat-aksi-sosial');
 }
 public function getSession($id)
 {
     // init
     $data = array();
     $event = Events::where('id', $id)->first();
     if ($event == false) {
         return App::abort('404');
     }
     $data['view'] = $event;
     // // get photos
     $data['photos'] = Photo::where('type_name', '=', 'events')->where('type_id', '=', $event->id)->where('status', '=', 1)->get();
     $data['social_actions'] = SocialAction::with(array('city', 'category'))->join('social_action_events', 'social_action_events.social_action_id', '=', 'social_actions.id')->where('event_id', '=', $event->id)->where('social_actions.status', '=', 1)->orderBy('social_actions.id', 'desc')->get();
     $data['social_target_id'] = SocialTarget::getAll();
     $data['social_action_category_id'] = SocialActionCategory::getAll();
     $data['city_id'] = City::getAll();
     Session::put('type_name', 'Events');
     Session::forget('type_id');
     Session::put('event_id', $event['id']);
     return Redirect::route('buat-aksi-sosial');
 }
 public function getSession($id)
 {
     // init
     $data = array();
     // get social target data - with slug
     $social_target = SocialTarget::with(array('city', 'category'))->where('id', '=', $id)->where('status', '=', 1)->first();
     if ($social_target == null) {
         return App::abort('404');
     }
     // get photos
     $photos = Photo::where('type_name', '=', 'social_targets')->where('type_id', '=', $social_target->id)->where('status', '=', 1)->get();
     // get social actions
     $social_actions = SocialAction::with(array('city', 'category'))->where('social_target_id', '=', $social_target->id)->where('status', '=', 1)->orderBy('id', 'desc')->get();
     // set data
     $data = array('social_target' => $social_target, 'photos' => $photos, 'social_actions' => $social_actions);
     $data['social_target_id'] = SocialTarget::getAll();
     $data['social_action_category_id'] = SocialActionCategory::getAll();
     $data['city_id'] = City::getAll();
     Session::put('type_name', 'SocialTarget');
     Session::put('type_id', $social_target->id);
     return Redirect::route('buat-aksi-sosial');
 }