jeudi 26 janvier 2017

Laravel call json version from controller?

I have implemented in my controller function $request->wantsJson() and there is content for my JSON output, how can I call json version?

Is there new route needed?

My code example:

public function customersList(Request $request) {
    if ($request->wantsJson()) {

    return response()->json($result);
    }

    return view('customers/list');
}



via Chebli Mohamed

Aucun commentaire:

Enregistrer un commentaire