public function show($id)
 {
     // get payment
     $payment = Payment::with(array('user', 'donations'))->find($id);
     if ($payment == null) {
         return App::abort('404');
     }
     // init
     $data = array('menu' => $this->_menu, 'title' => 'Pembayaran - ' . $payment->id, 'description' => '', 'breadcrumb' => array('Donasi & Pembayaran' => route('admin.donation'), $payment->id => route('admin.payment.show', $payment->id)));
     foreach ($payment->donations as $i => $donation) {
         $donation->setAppends(array('type'));
     }
     $data['payment'] = $payment;
     return View::make('admin.pages.payment.show')->with($data);
 }
Пример #2
0
 public function getPaymentsReport()
 {
     // Get the payments in the last 24 hours.
     $payments = \Payment::with('payment_type')->sinceHoursAgo(24);
     // Check if the payments are for a particular location
     if (isset($this->data['branch_id'])) {
         $payments->where('branch_id', $this->data['branch_id']);
     }
     // Construct
     foreach ($payments->get() as $payment) {
         $this->response->addMessage($payment->toArray());
     }
     if ($payments->count() > 0) {
         $this->response->setSuccess(1);
     } else {
         $this->response->addMessage('No data');
     }
     return $this->output();
 }
 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 donation
     $donation = Donation::with(array('user'))->find($id);
     if ($donation == null) {
         return App::abort('404');
     }
     // init
     $data = array('menu' => $this->_menu, 'title' => 'Donasi & Pembayaran - ' . $donation->id, 'description' => '', 'breadcrumb' => array('Donasi & Pembayaran' => route('admin.donation'), $donation->id => route('admin.donation.show', $donation->id)));
     // Get Donation
     $donation->setAppends(array('type'));
     $data['donation'] = $donation;
     // Get Payment that related with this
     if ($donation->payment_id != NULL) {
         $payment = Payment::with(array('user', 'donations'))->find($donation->payment_id);
         foreach ($payment->donations as $i => $donation) {
             $donation->setAppends(array('type'));
         }
         $data['payment'] = $payment;
     }
     return View::make('admin.pages.donation.show')->with($data);
 }
Пример #5
0
 public static function reject($id)
 {
     $payment = Payment::with(array('user', 'donations'))->find($id);
     if ($payment == null) {
         return array('success' => false, 'errors' => array('Pembayaran tidak ditemukan.'));
     }
     if ($payment->status != 0) {
         return array('success' => false, 'errors' => array('Pembayaran sudah pernah direspon oleh admin sebelumnya.'));
     }
     // delete
     // $payment->delete();
     $payment->status = 2;
     $payment->save();
     // update donation
     Donation::where('payment_id', '=', $payment->id)->update(array('status' => 0, 'payment_id' => NULL));
     // set type for each donation
     foreach ($payment->donations as $donation) {
         $donation->setAppends(array('type'));
     }
     // send email to donor
     Newsletter::addPaymentNewsletter($payment);
     return array('success' => true, 'data' => $payment);
 }
 public function showCoach($id)
 {
     $user = Auth::user();
     $team = Team::find($id);
     $club = $team->club;
     $coaches = $team->coaches()->get();
     $members = Member::where('team_id', '=', $team->id)->with('team')->get();
     $title = 'League Together - ' . $team->club->name . ' Teams';
     $pay = Payment::with(array('items' => function ($query) {
     }))->get();
     $sales = Item::where('team_id', $team->id)->get();
     $receivable = SchedulePayment::with('member')->whereHas('member', function ($query) use($team) {
         $query->where('team_id', '=', $team->id);
     })->get();
     $announcements = Announcement::where('team_id', $team->id)->get();
     return View::make('app.account.team.show')->with('page_title', $title)->with('team', $team)->with('club', $club)->with('coaches', $coaches)->with('members', $members)->with('sales', $sales)->with('receivable', $receivable)->with('announcements', $announcements)->withUser($user);
 }