Esempio n. 1
0
 /**
  * Display the specified resource.
  *
  * @param  int  $id
  * @return \Illuminate\Http\Response
  */
 public function show($id)
 {
     $member = Member::find($id);
     $birthday = Carbon::parse($member->birthday)->toFormattedDateString();
     $points = Point::where('member_id', $id)->get();
     $tambay_points = TambayPoint::where('member_id', $id)->get();
     return view('members.show', compact('member', 'points', 'tambay_points', 'birthday'));
 }
 /**
  * Remove the specified resource from storage.
  *
  * @param  int  $id
  * @return \Illuminate\Http\Response
  */
 public function destroy($memberId, $pointId)
 {
     $tambay_point = TambayPoint::find($pointId);
     $member = Member::find($memberId);
     $member->update(['total_points' => $member->total_points - $tambay_point->point]);
     $tambay_point->Delete('set null');
     return redirect()->action('TambayPointsController@index');
 }