lundi 1 août 2016

laravel throws error when returning ->first() in controller

this:

public function show($id)
    {
        return DB::table('apps')->where('id', $id)->first();//->get();
    }

will return an error: UnexpectedValueException in Response.php line 399: The Response content must be a string or object implementing __toString(), "object" given.

this will not return an error (but I cant use it since I need an object not array):

public function show($id)
    {
        return DB::table('apps')->where('id', $id)->get();
    }

whats wrong?

Thanks



via Chebli Mohamed

Aucun commentaire:

Enregistrer un commentaire