本文整理汇总了PHP中app\models\Payment::findOrFail方法的典型用法代码示例。如果您正苦于以下问题:PHP Payment::findOrFail方法的具体用法?PHP Payment::findOrFail怎么用?PHP Payment::findOrFail使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类app\models\Payment
的用法示例。
在下文中一共展示了Payment::findOrFail方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: readCallback
public static function readCallback($payload)
{
$crypt = new Encrypter(base64_decode(Config::get('services.etupay.key')), 'AES-256-CBC');
$payload = json_decode($crypt->decrypt($payload));
if ($payload && is_numeric($payload->service_data)) {
$paymentId = $payload->service_data;
$payment = Payment::findOrFail($paymentId);
switch ($payload->step) {
case 'INITIALISED':
$payment->state = 'returned';
break;
case 'PAID':
case 'AUTHORISATION':
$payment->state = 'paid';
break;
case 'REFUSED':
case 'CANCELED':
$payment->state = 'refused';
break;
case 'REFUNDED':
$payment->state = 'refunded';
break;
}
$payment->informations = ['transaction_id' => $payload->transaction_id];
$payment->save();
if ($payment->newcomer) {
$payment->newcomer->updateWei();
} elseif ($payment->student) {
$payment->student->updateWei();
}
return $payment;
}
return null;
}
示例2: index
public function index(Request $request)
{
$data = $request->json()->all('bags');
$payment = Payment::findOrFail($data['payment_id']);
$logistics = Logistics::findOrFail($data['logistics_id']);
$bags = Bag::with('stock.product')->find($data['bags']);
$order = new Order(array_except($data, 'bags'));
\DB::transaction(function () use($bags, $logistics, $payment, $order, $data, $request) {
$order_products = [];
foreach ($bags as $bag) {
$order_products[] = $bag->stock->pick($bag->quantity);
$bag->stock->save();
}
$order->user_id = $request->user->id;
$order->calc($order_products);
$order->save();
$order->products()->saveMany($order_products);
Bag::destroy($data['bags']);
});
return response()->created($order);
}
示例3: show
/**
* Display the specified resource.
*
* @param int $id
* @return \Illuminate\Http\Response
*/
public function show($id)
{
$obj = Payment::findOrFail($id);
return view('internal.promoter.payment.show', ['payment' => $obj]);
}
示例4: logo
public function logo(Request $request, $id)
{
$payment = Payment::findOrFail($id);
return \Image::make($payment->gateway->logo)->response();
}