本文整理匯總了PHP中Invitation::with方法的典型用法代碼示例。如果您正苦於以下問題:PHP Invitation::with方法的具體用法?PHP Invitation::with怎麽用?PHP Invitation::with使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類Invitation
的用法示例。
在下文中一共展示了Invitation::with方法的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: offsite_payment
public function offsite_payment()
{
$payerId = Request::query('PayerID');
$token = Request::query('token');
$invitation = Invitation::with('invoice.client.currency', 'invoice.client.account.account_gateways.gateway')->where('transaction_reference', '=', $token)->firstOrFail();
$invoice = $invitation->invoice;
$accountGateway = $invoice->client->account->account_gateways[0];
$gateway = self::createGateway($accountGateway);
try {
$details = self::getPaymentDetails($invoice);
$response = $gateway->completePurchase($details)->send();
$ref = $response->getTransactionReference();
if ($response->isSuccessful()) {
$payment = self::createPayment($invitation, $ref, $payerId);
Session::flash('message', trans('texts.applied_payment'));
return Redirect::to('view/' . $invitation->invitation_key);
} else {
$errorMessage = trans('texts.payment_error') . "\n\n" . $response->getMessage();
Session::flash('error', $errorMessage);
Utils::logError($errorMessage);
return Redirect::to('view/' . $invitation->invitation_key);
}
} catch (\Exception $e) {
$errorMessage = trans('texts.payment_error');
Session::flash('error', $errorMessage);
Utils::logError($errorMessage . "\n\n" . $e->getMessage());
return Redirect::to('view/' . $invitation->invitation_key);
}
}