public function show($id)
 {
     // get social target
     $social_target = SocialTarget::with(array('city', 'category', 'user'))->find($id);
     if ($social_target == null) {
         return App::abort('404');
     }
     // init
     $data = array('menu' => $this->_menu, 'title' => 'Target Sosial - ' . $social_target->name, 'description' => '', 'breadcrumb' => array('Kategori Target Sosial' => route('admin.social-target'), $social_target->name => route('admin.social-target.show', $social_target->id)));
     // 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('social_target_id', '=', $social_target->id)->orderBy('id', 'desc')->get();
     // Get Donations that related with this
     $data['donations'] = Donation::with(array('user'))->where('type_name', '=', 'social_targets')->where('type_id', '=', $social_target->id)->orderBy('id', 'desc')->get();
     // Get Photos that related with this
     $data['photos'] = Photo::where('type_name', '=', 'social_targets')->where('type_id', '=', $social_target->id)->orderBy('id', 'desc')->get();
     return View::make('admin.pages.social-target.show')->with($data);
 }
 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');
 }
Beispiel #5
0
 public static function getSocialTargetFront()
 {
     $check = SocialTarget::with(array('city', 'category', 'user'))->where('status', 1)->count();
     if ($check > 0) {
         return SocialTarget::with(array('city', 'category', 'user'))->where('status', 1)->take(5)->orderBy('created_at', 'DESC')->get();
     } else {
         return false;
     }
 }