SHARE
TWEET

Untitled

enkf Jan 28th, 2020 73 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. <?php
  2.  
  3. namespace App\Http\Controllers\Api;
  4.  
  5. use Illuminate\Http\Request;
  6. use App\Http\Controllers\Controller;
  7. use App\Models\Point;
  8. use Auth;
  9. use DB;
  10.  
  11. class PointController extends Controller
  12. {
  13.     public function index()
  14.    {
  15.     $member = Auth::guard('member-api')->user();
  16.     $points = Point::where('member_id',$member->id)
  17.                     ->orderBy('created_at', 'DESC')
  18.                     ->select('points.*', DB::raw("SUM(point) AS sum_point, GROUP_CONCAT(description SEPARATOR ', '"))
  19.                     ->groupBy('member_id')
  20.                     ->get();
  21.  
  22.        return response()->json([
  23.            'success' => true,
  24.            'message' => 'Get Point',
  25.            'results' => [
  26.                'point' => $points
  27.            ]
  28.         ], 200);
  29.    }
  30.  
  31.  
  32.  
  33.  
  34.  
  35. }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
Top