How to retrieve session data in service providers in laravel?Using laravel policy Authorization in blade view fileAdd Routes and Use Session Information in Service ProviderView Share doesn't return updated data, how then to share live data?How do I expire a PHP session after 30 minutes?Codeigniter Session->userdata is nulllaravel 5.1 trouble with queueing email sendinghow to pass a variable to service provider in Laravel?Laravel 5 how can add dynamic number of row on list viewHow to load data in pre-controller and pass directly to view in Laravel 5?Laravel session data get cleared out after redirect to next pageLaravel 5.1 Sessions not workingLaravel Session cannot Increase the variable valuelaravel session shopping cart - how to increase the quantity if the product already exists
What defines a person who is circumcised "of the heart"?
Singular Integration
Department head said that group project may be rejected. How to mitigate?
Island Perimeter
How did the Allies achieve air superiority on Sicily?
Why are logically related bit fields in MCU registers often in separate locations
Is there any mention of ghosts who live outside the Hogwarts castle?
Can someone get a spouse off a deed that never lived together and was incarcerated?
Was murdering a slave illegal in American slavery, and if so, what punishments were given for it?
Is it OK to look at the list of played moves during the game to determine the status of the 50 move rule?
Is it normal to "extract a paper" from a master thesis?
How to remove unwanted horizontal line from diagbox
Real Analysis: Proof of the equivalent definitions of the derivative.
Is the default 512 byte physical sector size appropriate for SSD disks under Linux?
Existence of a model of ZFC in which the natural numbers are really the natural numbers
Hook second router to internet wirelessly?
Proto-Indo-European (PIE) words with IPA
Why is this integration method not valid?
Split into three!
Why is this python script running in background consuming 100 % CPU?
Is it safe to redirect stdout and stderr to the same file without file descriptor copies?
Why "strap-on" boosters, and how do other people say it?
Were there any developed countries that became "undeveloped" for reasons other than war?
can conjure barrage stack with martial adept- disarming or tripping attack?
How to retrieve session data in service providers in laravel?
Using laravel policy Authorization in blade view fileAdd Routes and Use Session Information in Service ProviderView Share doesn't return updated data, how then to share live data?How do I expire a PHP session after 30 minutes?Codeigniter Session->userdata is nulllaravel 5.1 trouble with queueing email sendinghow to pass a variable to service provider in Laravel?Laravel 5 how can add dynamic number of row on list viewHow to load data in pre-controller and pass directly to view in Laravel 5?Laravel session data get cleared out after redirect to next pageLaravel 5.1 Sessions not workingLaravel Session cannot Increase the variable valuelaravel session shopping cart - how to increase the quantity if the product already exists
.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty,.everyoneloves__bot-mid-leaderboard:empty height:90px;width:728px;box-sizing:border-box;
I am developing a Laravel project. I am using Laravel 5.1. In my project, I am sharing data to all view in boot method of appServiceProvider in this way.
function boot()
$items = $this->itemRepo->getItems(session("key"));
view()->share('items', array('items'=>$items));
But session value is always null. I saw a lot of article online. But they were not working.So please how can I pass my session value to there ?
php laravel-5.1
add a comment |
I am developing a Laravel project. I am using Laravel 5.1. In my project, I am sharing data to all view in boot method of appServiceProvider in this way.
function boot()
$items = $this->itemRepo->getItems(session("key"));
view()->share('items', array('items'=>$items));
But session value is always null. I saw a lot of article online. But they were not working.So please how can I pass my session value to there ?
php laravel-5.1
add a comment |
I am developing a Laravel project. I am using Laravel 5.1. In my project, I am sharing data to all view in boot method of appServiceProvider in this way.
function boot()
$items = $this->itemRepo->getItems(session("key"));
view()->share('items', array('items'=>$items));
But session value is always null. I saw a lot of article online. But they were not working.So please how can I pass my session value to there ?
php laravel-5.1
I am developing a Laravel project. I am using Laravel 5.1. In my project, I am sharing data to all view in boot method of appServiceProvider in this way.
function boot()
$items = $this->itemRepo->getItems(session("key"));
view()->share('items', array('items'=>$items));
But session value is always null. I saw a lot of article online. But they were not working.So please how can I pass my session value to there ?
php laravel-5.1
php laravel-5.1
edited Jan 3 '16 at 15:20
Zakaria Acharki
57.6k134472
57.6k134472
asked Jan 3 '16 at 15:05
Wai Yan HeinWai Yan Hein
2,730646117
2,730646117
add a comment |
add a comment |
2 Answers
2
active
oldest
votes
I think your question answered in the following post Laravel 5 session data is not accessible in the app boot process, You should use middleware like Taylor Otwell said in Add event for session started conversation There is no session because there is no HTTP request.
Hope this helps.
1
Thank you. I solved it. I just created a new middleware called CommonMiddleware and just move my logic to middleware and share the data for all views in that middleware.
– Wai Yan Hein
Jan 3 '16 at 16:37
1
@WaiYanHein - Can you please post your answer? I need the same, thanks much!!
– Sachin Vairagi
Apr 11 '18 at 6:34
add a comment |
This might be an old post but I got here while being stuck with the same problem, so let me post my solution here,just incase someone needs it.
public function boot()
view()->composer('*', function ($view)
$view->with('your_var', Session::get('var') );
);
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%2f34577946%2fhow-to-retrieve-session-data-in-service-providers-in-laravel%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
I think your question answered in the following post Laravel 5 session data is not accessible in the app boot process, You should use middleware like Taylor Otwell said in Add event for session started conversation There is no session because there is no HTTP request.
Hope this helps.
1
Thank you. I solved it. I just created a new middleware called CommonMiddleware and just move my logic to middleware and share the data for all views in that middleware.
– Wai Yan Hein
Jan 3 '16 at 16:37
1
@WaiYanHein - Can you please post your answer? I need the same, thanks much!!
– Sachin Vairagi
Apr 11 '18 at 6:34
add a comment |
I think your question answered in the following post Laravel 5 session data is not accessible in the app boot process, You should use middleware like Taylor Otwell said in Add event for session started conversation There is no session because there is no HTTP request.
Hope this helps.
1
Thank you. I solved it. I just created a new middleware called CommonMiddleware and just move my logic to middleware and share the data for all views in that middleware.
– Wai Yan Hein
Jan 3 '16 at 16:37
1
@WaiYanHein - Can you please post your answer? I need the same, thanks much!!
– Sachin Vairagi
Apr 11 '18 at 6:34
add a comment |
I think your question answered in the following post Laravel 5 session data is not accessible in the app boot process, You should use middleware like Taylor Otwell said in Add event for session started conversation There is no session because there is no HTTP request.
Hope this helps.
I think your question answered in the following post Laravel 5 session data is not accessible in the app boot process, You should use middleware like Taylor Otwell said in Add event for session started conversation There is no session because there is no HTTP request.
Hope this helps.
answered Jan 3 '16 at 15:31
Zakaria AcharkiZakaria Acharki
57.6k134472
57.6k134472
1
Thank you. I solved it. I just created a new middleware called CommonMiddleware and just move my logic to middleware and share the data for all views in that middleware.
– Wai Yan Hein
Jan 3 '16 at 16:37
1
@WaiYanHein - Can you please post your answer? I need the same, thanks much!!
– Sachin Vairagi
Apr 11 '18 at 6:34
add a comment |
1
Thank you. I solved it. I just created a new middleware called CommonMiddleware and just move my logic to middleware and share the data for all views in that middleware.
– Wai Yan Hein
Jan 3 '16 at 16:37
1
@WaiYanHein - Can you please post your answer? I need the same, thanks much!!
– Sachin Vairagi
Apr 11 '18 at 6:34
1
1
Thank you. I solved it. I just created a new middleware called CommonMiddleware and just move my logic to middleware and share the data for all views in that middleware.
– Wai Yan Hein
Jan 3 '16 at 16:37
Thank you. I solved it. I just created a new middleware called CommonMiddleware and just move my logic to middleware and share the data for all views in that middleware.
– Wai Yan Hein
Jan 3 '16 at 16:37
1
1
@WaiYanHein - Can you please post your answer? I need the same, thanks much!!
– Sachin Vairagi
Apr 11 '18 at 6:34
@WaiYanHein - Can you please post your answer? I need the same, thanks much!!
– Sachin Vairagi
Apr 11 '18 at 6:34
add a comment |
This might be an old post but I got here while being stuck with the same problem, so let me post my solution here,just incase someone needs it.
public function boot()
view()->composer('*', function ($view)
$view->with('your_var', Session::get('var') );
);
add a comment |
This might be an old post but I got here while being stuck with the same problem, so let me post my solution here,just incase someone needs it.
public function boot()
view()->composer('*', function ($view)
$view->with('your_var', Session::get('var') );
);
add a comment |
This might be an old post but I got here while being stuck with the same problem, so let me post my solution here,just incase someone needs it.
public function boot()
view()->composer('*', function ($view)
$view->with('your_var', Session::get('var') );
);
This might be an old post but I got here while being stuck with the same problem, so let me post my solution here,just incase someone needs it.
public function boot()
view()->composer('*', function ($view)
$view->with('your_var', Session::get('var') );
);
answered Mar 23 at 20:36
Excellent LawrenceExcellent Lawrence
22425
22425
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.
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%2f34577946%2fhow-to-retrieve-session-data-in-service-providers-in-laravel%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