public function show($id) { // get social target $social_action = SocialAction::with(array('city', 'category', 'user'))->where('id', '=', $id)->orderBy('id', 'desc')->first(); if ($social_action == null) { return App::abort('404'); } // init $data = array('menu' => $this->_menu, 'title' => 'Target Sosial - ' . $social_action->name, 'description' => '', 'breadcrumb' => array('Kategori Aksi Social' => route('admin.social-action'), $social_action->name => route('admin.social-action.show', $social_action->id))); // Get category $data['social_actions'] = $social_action; // Get Donations that related with this $data['donations'] = Donation::with(array('user'))->where('type_name', '=', 'social_actions')->where('type_id', '=', $social_action->id)->orderBy('id', 'desc')->get(); // Get Photos that related with this $data['photos'] = Photo::where('type_name', '=', 'social_actions')->where('type_id', '=', $social_action->id)->orderBy('id', 'desc')->get(); return View::make('admin.pages.social-action.show')->with($data); }
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 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); }
public function show($id) { // get social target $user = User::with('city')->find($id); if ($user == null) { return App::abort('404'); } // init $data = array('menu' => $this->_menu, 'title' => 'Nama pengguna - ' . $user->firstname . ' ' . $user->lastname, 'description' => '', 'breadcrumb' => array('Pengguna Bagikasih' => route('admin.user'), $user->firstname => route('admin.user.show', $user->id))); $data['users'] = $user; $social_target = SocialTarget::with(array('city', 'category', 'user'))->where('user_id', $user->id)->get(); // Get Social Target $data['social_target'] = $social_target; // Get Social Actions that related with this $data['social_actions'] = SocialAction::with(array('city', 'category', 'user'))->where('user_id', '=', $user->id)->orderBy('id', 'desc')->get(); // Get Donations that related with this $data['donations'] = Donation::with(array('user'))->where('type_name', '=', 'users')->where('type_id', '=', $user->id)->orderBy('id', 'desc')->get(); // Get Photos that related with this $data['photos'] = Photo::where('type_name', '=', 'users')->where('type_id', '=', $user->id)->orderBy('id', 'desc')->get(); return View::make('admin.pages.user.show')->with($data); }
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'); }
public static function getSocialActionFront() { $check = SocialAction::with('socialTarget', 'user', 'city')->where('status', 1)->count(); if ($check > 0) { return SocialAction::with('socialTarget', 'user', 'city')->where('status', 1)->take(10)->orderBy('created_at', 'DESC')->get(); } else { return false; } }