Пример #1
0
 public function cancel()
 {
     $member = ActivityMember::findOrFail($this->member_id);
     $this->delete();
     $member->states = 0;
     $member->save();
 }
Пример #2
0
 public function acts($id)
 {
     $user = User::findOrFail($id);
     $members = ActivityMember::findByUser($user->id, 0);
     $members->merge(ActivityMember::findByUser($user->id, 1));
     $old_members = ActivityMember::findByUser($user->id, 2);
     return view('space.acts', compact('user', 'members', 'old_members'));
 }
 private function updateOrder($result, $states)
 {
     $order = ActivityOrder::byCode($result['out_trade_no']);
     if ($order != null) {
         $member = ActivityMember::findOrFail($order->member_id);
         $order->bank_code = $result['bank_type'];
         $order->pay_type = 'weixin';
         $order->states = $states;
         $order->paying = 0;
         $order->pay_code = $result['transaction_id'];
         $order->pay_time = Carbon::createFromFormat('YmdHis', $result['time_end']);
         $order->save();
         $member->states = 2;
         $member->save();
     }
 }
Пример #4
0
 public static function findByUser($userId, $astate)
 {
     return ActivityMember::with('activity')->where('user_id', $userId)->whereHas('activity', function ($query) use($astate) {
         $query->where('states', $astate);
     })->get();
 }
Пример #5
0
 public function showOrder($id, Request $request)
 {
     $order = ActivityOrder::findOrFail($id);
     $activity = Activity::findOrFail($order->activity_id);
     $member = ActivityMember::findOrFail($order->member_id);
     $discount = $order->discount;
     $amount = $order->amount;
     return view('activity.order.show', compact('order', 'activity', 'member', 'discount', 'amount'));
 }