Question: I want to format pagination in laravel like this: 

```
api/posts?from=1&to=10

```

I tried:

```
$posts = new LengthAwarePaginator(Post::all(), 100, 10);
return $posts->toArray();

```

Which didn’t work at all :( Please help

Answer: 
Try this

```
$x = array_search ('english', $request->all());

```
use 

```
$x = array_keys ($request->all(),'english');

```

returns all the keys having value english

if given only the array returns all the keys. The search field is included as a second parameter to get keys for the given search value and there is a optional third parameter strict which may be either true or false, if set strict validation occurstrue