lundi 12 août 2019

How can I return data in a JSON format as soon as the user logs in

I want to return some data as soon as the user logs in. But I can't see any returned data from network tab of Chrome Dev tools using the code below.

in the login controller I put the code below

    protected function authenticated()
    {
        $data = [];
        $userId = Auth::user()->id;
        $role = Auth::user()->role;
        $data[] = $userId;
        $data[] = $role;
        $data_to_json = json_encode($data);
        return redirect('/home')->with($data_to_json);
    }



via Chebli Mohamed

Aucun commentaire:

Enregistrer un commentaire