I'm trying to convert a query to an array with the method toArray()
but it doesn't work for the query builder. Any ideas for convert it?
Example
DB::table('user')->where('name',=,'Jhon')->get()->toArray();
toArray is a model method of Eloquent, so you need to a Eloquent model, try this:
User::where('name', '=', 'Jhon')->get()->toArray();