1

AM using angular4 with laravel and am trying to append query parameters and read them in laravel as follows My http request is get

The url after adding parameters look like

http://localhost:8000/user-management/users?global_filter=12 
 ?paginator=10?page=0?sortfield=username|asc

Now in my laravel routes i have

Route::group(['prefix'=> 'user-management','middleware'=>['auth:api']], function() {
    Route::resource('users', "UsersController");
});

Now in my usersController i have

class UsersController extends Controller{

   public function index(Request $request)
     { 
       return $request->all();
    }

Now the above returns

global_filter:"null?paginator=10?page=0..."

The problem comes when i want to access the paginator value which is null as above.

How do i go about this so that i can be able to retrieve attached values of globalfilter, paginator and sortfield. I still would wish to continue using the route resource

7
  • 2
    Only one ? allowed in your url, other parameters are separated by & Commented Jan 24, 2018 at 8:46
  • thanks it now works Commented Jan 24, 2018 at 8:48
  • there is a missed part in yours question, how do you create http://localhost:8000/user-management/users?global_filter=12 ?paginator=10?page=0?sortfield=username|asc ? please add it's snippet to the question. the problem is because of two ? sign, Commented Jan 24, 2018 at 8:53
  • @zhilevan i just attach ? after a variable and the add = value Commented Jan 24, 2018 at 9:24
  • @GEOFFREYMWANGI I cant help you with this. pelase provide the part which this url http://localhost:8000/user-management/users?global_filter=12 ?paginator=10?page=0?sortfield=username|asc is generated. Commented Jan 24, 2018 at 10:31

1 Answer 1

1

According to the Url in your question http://localhost:8000/user-management/users?global_filter=12?paginator=10?page=0sortfield=username|ascz it seems you wrongly add ? twice and it caouse the first queryString eliminated and just second part detected, I suggest you use & instead of the second ?.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.