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;








5















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 ?










share|improve this question






























    5















    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 ?










    share|improve this question


























      5












      5








      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 ?










      share|improve this question
















      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






      share|improve this question















      share|improve this question













      share|improve this question




      share|improve this question








      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






















          2 Answers
          2






          active

          oldest

          votes


















          1














          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.






          share|improve this answer


















          • 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


















          0














          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') );
          );






          share|improve this answer























            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
            );



            );













            draft saved

            draft discarded


















            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









            1














            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.






            share|improve this answer


















            • 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














            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.






            share|improve this answer


















            • 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








            1







            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.






            share|improve this answer













            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.







            share|improve this answer












            share|improve this answer



            share|improve this answer










            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












            • 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













            0














            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') );
            );






            share|improve this answer



























              0














              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') );
              );






              share|improve this answer

























                0












                0








                0







                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') );
                );






                share|improve this answer













                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') );
                );







                share|improve this answer












                share|improve this answer



                share|improve this answer










                answered Mar 23 at 20:36









                Excellent LawrenceExcellent Lawrence

                22425




                22425



























                    draft saved

                    draft discarded
















































                    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.




                    draft saved


                    draft discarded














                    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





















































                    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







                    Popular posts from this blog

                    SQL error code 1064 with creating Laravel foreign keysForeign key constraints: When to use ON UPDATE and ON DELETEDropping column with foreign key Laravel error: General error: 1025 Error on renameLaravel SQL Can't create tableLaravel Migration foreign key errorLaravel php artisan migrate:refresh giving a syntax errorSQLSTATE[42S01]: Base table or view already exists or Base table or view already exists: 1050 Tableerror in migrating laravel file to xampp serverSyntax error or access violation: 1064:syntax to use near 'unsigned not null, modelName varchar(191) not null, title varchar(191) not nLaravel cannot create new table field in mysqlLaravel 5.7:Last migration creates table but is not registered in the migration table

                    용인 삼성생명 블루밍스 목차 통계 역대 감독 선수단 응원단 경기장 같이 보기 외부 링크 둘러보기 메뉴samsungblueminx.comeh선수 명단용인 삼성생명 블루밍스용인 삼성생명 블루밍스ehsamsungblueminx.comeheheheh

                    155 수학 과학 기타 둘러보기 메뉴eh추가해eh문서를 완성해