本文整理汇总了PHP中Payment::with方法的典型用法代码示例。如果您正苦于以下问题:PHP Payment::with方法的具体用法?PHP Payment::with怎么用?PHP Payment::with使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Payment
的用法示例。
在下文中一共展示了Payment::with方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: show
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: getPaymentsReport
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();
}
示例3: index
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);
}
示例4: show
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: reject
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);
}
示例6: showCoach
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);
}