Update ProfileSponsorController

pull/1615/head
Daniel Supernault 6 years ago
parent f22a4b2d75
commit bd61a921e8
No known key found for this signature in database
GPG Key ID: 0DEF1C662C9033F7

@ -10,7 +10,8 @@ class ProfileSponsorController extends Controller
{
public function get(Request $request, $id)
{
$res = ProfileSponsor::whereProfileId($id)->firstOrFail()->sponsors;
return response($res)->header('Content-Type', 'application/json');
$profile = ProfileSponsor::whereProfileId($id)->first();
$res = $profile ? $profile->sponsors : [];
return response()->json($res);
}
}

Loading…
Cancel
Save