How to select only the last array of an array object that happened to laravel lumen?

0

because that I put the image of postman arrives me the object of array from angular and I want to select only the last one

This is my lumen code I've tried with this but I get an error it may be from the library but I do not know

 use Illuminate\Support\last;


 $data =$request->json()->All()->last();
 return response()->json([$data],200)

Postman

what the laravel lumen backend responds to

    
asked by ortiga 03.03.2018 в 23:00
source

1 answer

1

As it is an arrangement, just use the end() function that provides PHP .

$last = end($request->all());

More information about the end() function in the PHP documentation:

answered by 03.03.2018 / 23:30
source