Update ProfileSponsorController

This commit is contained in:
Daniel Supernault 2019-08-17 01:41:35 -06:00
parent f22a4b2d75
commit bd61a921e8
No known key found for this signature in database
GPG Key ID: 0DEF1C662C9033F7
1 changed files with 3 additions and 2 deletions

View File

@ -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);
}
}