当前位置: 首页>>代码示例>>PHP>>正文


PHP Payment::findOrFail方法代码示例

本文整理汇总了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;
 }
开发者ID:ungdev,项目名称:integration-UTT,代码行数:34,代码来源:EtuPay.php

示例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);
 }
开发者ID:kshar1989,项目名称:dianpou,代码行数:21,代码来源:CheckoutController.php

示例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]);
 }
开发者ID:TAMQuiroz,项目名称:starkTicket,代码行数:11,代码来源:PaymentController.php

示例4: logo

 public function logo(Request $request, $id)
 {
     $payment = Payment::findOrFail($id);
     return \Image::make($payment->gateway->logo)->response();
 }
开发者ID:kshar1989,项目名称:dianpou,代码行数:5,代码来源:PaymentController.php


注:本文中的app\models\Payment::findOrFail方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。