0

How I can take code from http://domain.com/auth/fb?code=kakakak.

Because $request->input('code') return null and I don't know why. Thanks

4 Answers 4

1

What about using the query() method since the code is part of the query string. For example:

$request->query('code');

See the documentation for more info.

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

Comments

1

This code put into your domain config

location / {
     try_files $uri $uri/ /index.php?$args;
}

Comments

0

Try the input() method:

echo $request->input('code');

As described in the Docs (In this case Request::input() and $request->input() do the same)


Test route

Here's a basic test to see if query parameters are really not working. Add this to routes.php:

Route::get('test', function(){
    dd(Request::input('foo'));
});

And access:

http://domain.com/test?foo=bar

You should see "bar" printed on your screen.

8 Comments

dd($request) returned: ` #content: null #languages: null #charsets: null #encodings: null #acceptableContentTypes: null #pathInfo: "/auth/fb" #requestUri: "/auth/fb?code=dupa" #baseUrl: "" #basePath: null #method: "GET" #format: null #session: Store {#113 ▶} #locale: null #defaultLocale: "en"`
How exactly do you get the $request variable? Can I see a bit more of your code?
public function fb(AuthenticateUser $authenticateUser, Request $request) { dd($request->query('code')); //$hasCode = $request->has('code'); // return $authenticateUser->execute($hasCode, $this); }
Make sure to type hint the correct Request. The full path is Illuminate\Http\Request
I have link this: use Illuminate\Http\Request;
|
0

You can use Request::get('code') to get code from url.

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.