Upgrade to Pro — share decks privately, control downloads, hide ads and more …

Laravel ViewComposer

Laravel ViewComposer

Laravel ViewComposer

Takayuki

June 14, 2019
Tweet

More Decks by Takayuki

Other Decks in Programming

Transcript

  1. Copyright Re:Build.inc All Rights Reserved. 1.ձࣾ঺հ ◆ձ໊ࣾ גࣜձࣾRe:Build ◆ॅॴ ԭೄݝԭೄࢢதԝ̍ஸ໨̍̒−̕

    ◆ࣄۀ಺༰ ɾࣗࣾWEBαʔϏεͷاըɾ։ൃɻ ɾडୗ։ൃ ◆ࣾһ 5໊ ◆ΤϯδχΞͷಇ͖ํ ϦϞʔτϫʔΫՄೳͳࣗ༝ͳಇ͖ํΛਪ঑ͯ͠·͢ʂ
  2. 8 2 View composerͱ͸ Ϗϡʔίϯϙʔβ͸Ϗϡʔ͕Ϩϯμʔ͞ ΕΔ࣌ʹݺͼग़͞ΕΔɺίʔϧόοΫ͔ Ϋϥεϝιουͷ͜ͱͰ͢ɻ
 
 Ϗϡʔ͕Ϩϯμʔ͞ΕΔͨͼʹ݁߹ͨ͠ ͍৘ใ͕͋ΔͳΒɺϏϡʔίϯϙʔβ͕

    ϩδοΫΛҰՕॴʹ·ͱΊΔͷʹ໾ཱͪ ·͢ɻ https://readouble.com/laravel/5.5/ja/views.html Controller View Router HTMLΛฦ٫ HTML viewϑΝΠϧʹ ม਺ΛόΠϯυ /mypage΁ΞΫηε ViewComposer ڞ௨ͰόΠϯυͨ͠ ͍ม਺Λ·ͱΊΔ ※શମͷΠϝʔδͷҝɺ ࡉ͔͍෦෼͸লུ͍ͯ͠·͢ɻ
  3. 1 6 ᶅComposerΫϥεͷ࡞੒ ʮapp/Http/ViewComposersʯͱ͍͏ ܗ Ͱ σ Ο Ϩ Ϋ

    τ Ϧ Λ ࡞ ੒ ͠ ɺ ViewComposersσΟϨΫτϦͷதʹ ʮLayoutComposer.phpʯΛ࡞੒͠· ͢ɻ