Skip to content Skip to sidebar Skip to footer

Laravel Collection Accentuation Error

I have a big problem with my program (WebAPI) made in Laravel. First, this is software's configuration: Laravel Framework 5.4.30 SQL Server 2012 I was trying to return a Json of

Solution 1:

There is a simple way achieve this rather than returning a json_encode try to return a collection.

classStudentsControllerextendsController{
   publicfunctionindex(Request $request){

    $class = $request['class'];

    $return = DB::table('students')
    ->where("class", $class)
    ->get();


    return$return;

   }
}

It will return the result as expected.

Post a Comment for "Laravel Collection Accentuation Error"