dimanche 4 octobre 2015

Call to a member function toJson() on a non-object Laravel 5.0

from below code reference, I am joining the users table, user_details table and user_config table with each record similar key and no problem with that (it works), yet when I'm trying to convert the result records to json array, it gives me this error

Call to a member function toJson() on a non-object

public function get_users_table(){
       $users = DB::table('users')
        ->join('user_details', 'users.id', '=', 'user_details.id')
        ->join('user_config', 'users.id', '=', 'user_config.id')
        //->select('users.*', 'contacts.phone', 'orders.price')
        ->get()->toJson();

       return response()->json(['success' => true, 'users' => $users]);
    }

Any ideas, help?



via Chebli Mohamed

Aucun commentaire:

Enregistrer un commentaire