Check if cookie is existing returns all aray
I am trying to check if cookie is stored or not. If not existing, it returns all the stored cookies in an application. It's supposed to be null, right?
$cookie = $request->cookie(config('app.name' .'_VERIFIED'));
dump($cookie);
This code above, if cookie is not existing, returns all stored cookies. If existing, then it will return the value. I want a null value if not existing.
laravel cookies
add a comment |
I am trying to check if cookie is stored or not. If not existing, it returns all the stored cookies in an application. It's supposed to be null, right?
$cookie = $request->cookie(config('app.name' .'_VERIFIED'));
dump($cookie);
This code above, if cookie is not existing, returns all stored cookies. If existing, then it will return the value. I want a null value if not existing.
laravel cookies
add a comment |
I am trying to check if cookie is stored or not. If not existing, it returns all the stored cookies in an application. It's supposed to be null, right?
$cookie = $request->cookie(config('app.name' .'_VERIFIED'));
dump($cookie);
This code above, if cookie is not existing, returns all stored cookies. If existing, then it will return the value. I want a null value if not existing.
laravel cookies
I am trying to check if cookie is stored or not. If not existing, it returns all the stored cookies in an application. It's supposed to be null, right?
$cookie = $request->cookie(config('app.name' .'_VERIFIED'));
dump($cookie);
This code above, if cookie is not existing, returns all stored cookies. If existing, then it will return the value. I want a null value if not existing.
laravel cookies
laravel cookies
asked Nov 19 '18 at 14:06
MiniDr
6717
6717
add a comment |
add a comment |
2 Answers
2
active
oldest
votes
What you want is the default behavior of laravel. But if the first parameter of $request->cookie() is null it will return all cookie values. You have to make sure that you always get a value from config('app.name' .'_VERIFIED')
add a comment |
The way method $request->cookie work is, when you past a key to the cookie function, It will call the cookie method which is define in IlluminateHttpConcerns Concern which call the retrieveItem method which take the cookies is define like this
protected function retrieveItem($source, $key, $default){}
the $source parameter will set to cookies and the $key will be set to the key you past, if the key is set to null, it will return all content of the cookie object. if $key is not null it will call the method get on the cookies source which is of type SymfonyComponentHttpFoundationParameterBag like define in the SymfonyComponentHttpFoundationRequest which is the class that IlluminateHttpRequest class extends. Which return the content of key depending of it value.
add a comment |
Your Answer
StackExchange.ifUsing("editor", function () {
StackExchange.using("externalEditor", function () {
StackExchange.using("snippets", function () {
StackExchange.snippets.init();
});
});
}, "code-snippets");
StackExchange.ready(function() {
var channelOptions = {
tags: "".split(" "),
id: "1"
};
initTagRenderer("".split(" "), "".split(" "), channelOptions);
StackExchange.using("externalEditor", function() {
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled) {
StackExchange.using("snippets", function() {
createEditor();
});
}
else {
createEditor();
}
});
function createEditor() {
StackExchange.prepareEditor({
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader: {
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
},
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
});
}
});
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53376381%2fcheck-if-cookie-is-existing-returns-all-aray%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
2 Answers
2
active
oldest
votes
2 Answers
2
active
oldest
votes
active
oldest
votes
active
oldest
votes
What you want is the default behavior of laravel. But if the first parameter of $request->cookie() is null it will return all cookie values. You have to make sure that you always get a value from config('app.name' .'_VERIFIED')
add a comment |
What you want is the default behavior of laravel. But if the first parameter of $request->cookie() is null it will return all cookie values. You have to make sure that you always get a value from config('app.name' .'_VERIFIED')
add a comment |
What you want is the default behavior of laravel. But if the first parameter of $request->cookie() is null it will return all cookie values. You have to make sure that you always get a value from config('app.name' .'_VERIFIED')
What you want is the default behavior of laravel. But if the first parameter of $request->cookie() is null it will return all cookie values. You have to make sure that you always get a value from config('app.name' .'_VERIFIED')
answered Nov 19 '18 at 14:30
Remul
1,1181113
1,1181113
add a comment |
add a comment |
The way method $request->cookie work is, when you past a key to the cookie function, It will call the cookie method which is define in IlluminateHttpConcerns Concern which call the retrieveItem method which take the cookies is define like this
protected function retrieveItem($source, $key, $default){}
the $source parameter will set to cookies and the $key will be set to the key you past, if the key is set to null, it will return all content of the cookie object. if $key is not null it will call the method get on the cookies source which is of type SymfonyComponentHttpFoundationParameterBag like define in the SymfonyComponentHttpFoundationRequest which is the class that IlluminateHttpRequest class extends. Which return the content of key depending of it value.
add a comment |
The way method $request->cookie work is, when you past a key to the cookie function, It will call the cookie method which is define in IlluminateHttpConcerns Concern which call the retrieveItem method which take the cookies is define like this
protected function retrieveItem($source, $key, $default){}
the $source parameter will set to cookies and the $key will be set to the key you past, if the key is set to null, it will return all content of the cookie object. if $key is not null it will call the method get on the cookies source which is of type SymfonyComponentHttpFoundationParameterBag like define in the SymfonyComponentHttpFoundationRequest which is the class that IlluminateHttpRequest class extends. Which return the content of key depending of it value.
add a comment |
The way method $request->cookie work is, when you past a key to the cookie function, It will call the cookie method which is define in IlluminateHttpConcerns Concern which call the retrieveItem method which take the cookies is define like this
protected function retrieveItem($source, $key, $default){}
the $source parameter will set to cookies and the $key will be set to the key you past, if the key is set to null, it will return all content of the cookie object. if $key is not null it will call the method get on the cookies source which is of type SymfonyComponentHttpFoundationParameterBag like define in the SymfonyComponentHttpFoundationRequest which is the class that IlluminateHttpRequest class extends. Which return the content of key depending of it value.
The way method $request->cookie work is, when you past a key to the cookie function, It will call the cookie method which is define in IlluminateHttpConcerns Concern which call the retrieveItem method which take the cookies is define like this
protected function retrieveItem($source, $key, $default){}
the $source parameter will set to cookies and the $key will be set to the key you past, if the key is set to null, it will return all content of the cookie object. if $key is not null it will call the method get on the cookies source which is of type SymfonyComponentHttpFoundationParameterBag like define in the SymfonyComponentHttpFoundationRequest which is the class that IlluminateHttpRequest class extends. Which return the content of key depending of it value.
answered Nov 19 '18 at 14:51
Yves Kipondo
1,340414
1,340414
add a comment |
add a comment |
Thanks for contributing an answer to Stack Overflow!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Some of your past answers have not been well-received, and you're in danger of being blocked from answering.
Please pay close attention to the following guidance:
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53376381%2fcheck-if-cookie-is-existing-returns-all-aray%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
