php - How do I get only active parameters with Laravel Postman?
I am making a admin portal for a project with Laravel, whereby the users will be able to be sorted according to name, designation or department.
I only want to get the currently active parameters (basically when the checkbox is ticked beside the key name) in Postman and pass them to Laravel (Request) to sort accordingly. If let??�s say we want to sort them by their name in ascending or descending order.
How do I do that? Thank you :)
This is my current postman request (as you can see I have other parameters): image here
So if I want to sort the users in an ascending order, it will be: http://localhost/whereabout/wa/users/sort?order=asc
and if its by their designation: http://localhost/whereabout/wa/users/sort?desig=lecturer
Do I need different routes to sort them, like one for the names and another for designations only, or I can sort them accordingly, using one route?
** Sorry if I am a bit vague, I am a little new to Laravel and am learning slowly. **
Answer
Solution:
Create API call on your server side that will get extra parameter for sorting . and give your users API call with extra parameter like sortName ;
example.com/api/getUsers/?sortNameAscending=true
on the server side check the call
if($sortNameAscending){
return $sortNamesAscending
}
Source