Slide 1

Slide 1 text

Laravel Meetup Tokyo Vol.12 ٢ా͋ͻΔ (@strtyuu) &MPRVFOUʹผΕΛࠂ͛Δ λΠϛϯάʹ͍ͭͯߟ͑ͨ

Slide 2

Slide 2 text

ࣗݾ঺հ ٢ా͋ͻΔ !TUSUZVV τΡΪϟολʔגࣜձࣾ 4PGUXBSF&OHJOFFS

Slide 3

Slide 3 text

$VSBUJPO$PNNVOJDBUJPO1MBUGPSN IUUQTUPHFUUFSDPN ·ͱΊΑ͏ɺ͋ͭ·Ζ͏

Slide 4

Slide 4 text

&MPRVFOU Active Record Domain Model ORM × ×

Slide 5

Slide 5 text

03. ɾ%#͔Βऔಘͨ͠஋ΛΦϒδΣΫτʹม׵͢Δ΋ͷ

Slide 6

Slide 6 text

"DUJWF3FDPSE ɾςʔϒϧɾϏϡʔͷεΩʔϚͱີ݁߹ͨ͠ϓϩύςΟ ɾϨίʔυΛΠϯελϯεԽͯ͠ৼΔ෣͍Λ࣋ͨͤΔ ɾυϝΠϯϞσϧͷҰछ ɾ%#ΞΫηεͷΧϓηϧԽ

Slide 7

Slide 7 text

%PNBJO.PEFM ɾυϝΠϯʹଘࡏ͢Δ֓೦ΛΫϥεԽͨ͠΋ͷ ɾυϝΠϯʹয఺Λ౰ͯͨɺ७ਮͳϩδοΫͷू·Γ

Slide 8

Slide 8 text

&MPRVFOUͷྑ͍ॴ ɾߴػೳʂ ɾָʹ։ൃ͕Ͱ͖Δʂ ɾศརͳϥΠϒϥϦ΋ͨ͘͞Μʂ

Slide 9

Slide 9 text

&MPRVFOUͷਏͦ͏ͳॴ ɾΫΤϦΛ࠷దԽ͍ͨ͠ͱ͖ ɾ3FQPTJUPSZύλʔϯͱͷ૬ੑ͕ඍົʁ ɾϑΝοτʹͳΓ͕ͪ ɾϞσϧ͕ςʔϒϧߏ଄ͱҰக͠ͳ͍ͱ͖

Slide 10

Slide 10 text

ΫΤϦͷ࠷దԽ

Slide 11

Slide 11 text

4&-&$5 '30.AQPTUTA 8)&3&AQPTUTAAJEA -*.*5 4&-&$5 '30.ADPNNFOUTA 8)&3& ADPNNFOUTAAQPTU@JEA "/%ADPNNFOUTAAQPTU@JEA*4/05/6--

Slide 12

Slide 12 text

4&-&$5 '30.AVTFSTA 8)&3&&9*454 4&-&$5 '30.AQPTUTA 8)&3& AVTFSTAAJEAAQPTUTAAVTFS@JEA

Slide 13

Slide 13 text

ɾ஗͍ΫΤϦ͕ు͔Εͯਏ͍ ಀ͛ಓ͕͋ΔͷͰɺผΕΛࠂ͛Δཧ༝ʹ͸ͳ Γʹ͍͘ʁ ɾ଎౓͕ڐ༰ൣғͰ͋Ε͹ແࢹ͢Δ͜ͱ΋ ɾΫϦςΟΧϧͳॴ͚ͩී௨ʹ42-Λॻ͍ͯ ޡຐԽ͢ͱ͔΋ग़དྷΔ

Slide 14

Slide 14 text

Repositoryύλʔϯͱͷ ૬ੑ͕ඍົʁ

Slide 15

Slide 15 text

3FQPTJUPSZύλʔϯ ɾӬଓԽઌͱͷ΍ΓͱΓΛӅณ͢Δ

Slide 16

Slide 16 text

Slide 17

Slide 17 text

Slide 18

Slide 18 text

͑ͬ

Slide 19

Slide 19 text

ɾ&MPRVFOUͰ%#ΞΫηε͕ग़དྷΔ͍ͤͰɺ ɹ3FQPTJUPSZͷ֎ͰΫΤϦΛॻ͍ͯ͠·͏ &MPRVFOUʹผΕΛࠂ͛ΔΑΓ͸ɺίʔυϨ Ϗϡʔͱ͔ͰೝࣝΛ߹Θͤͨํ͕ྑͦ͞͏ ɾ&MPRVFOUͷ͍ͤͱ͍͏͔ɺ࣮૷ऀͷ໰୊

Slide 20

Slide 20 text

ϑΝοτʹͳΓ͕ͪ

Slide 21

Slide 21 text

ΈΜͳ͕&MPRVFOUʹ΍Βͤͯ ͦ͏ͳ͜ͱ ɾ%#ͱͷ΍ΓͱΓ ɾଞͷ&MPRVFOUͱͷϦϨʔγϣϯ ɾυϝΠϯϞσϧͱͯ͠ͷৼΔ෣͍

Slide 22

Slide 22 text

&MPRVFOUΛϑϧ׆༻ͯ͠Δਓ ͕΍ͬͯͦ͏ͳ͜ͱ ɾϓϩύςΟͷόϦσʔγϣϯ ɾϓϨθϯςʔγϣϯϩδοΫ

Slide 23

Slide 23 text

※Laravel Boilerplate - https://github.com/rappasoft/laravel-5-boilerplate/blob/master/app/ Models/Auth/Traits/Attribute/UserAttribute.php ϓϩύςΟͷόϦσʔγϣϯ

Slide 24

Slide 24 text

※Laravel Boilerplate - https://github.com/rappasoft/laravel-5-boilerplate/blob/master/app/ Models/Auth/Traits/Attribute/UserAttribute.php ϓϨθϯςʔγϣϯϩδοΫ

Slide 25

Slide 25 text

ɾ&MPRVFOU͕ศར͗͢ΔͨΊʹɺ͋Ε΋͜ Ε΋&MPRVFOUʹ࣮૷͢Δ͜ͱͰ'BUʹͳͬͯ ͠·͏͜ͱ͕͋Δ &MPRVFOUʹผΕΛࠂ͛ͳͯ͘΋ɺ੹຿͝ͱ ʹΫϥεΛ෼͚Ε͹ই͸༊͑Δ͸ͣ ɾ&MPRVFOUͷ͍ͤͱ͍͏͔ɺΫϥεઃܭͷ ໰୊

Slide 26

Slide 26 text

ςʔϒϧߏ଄ͱҰக͠ͳ͍ Ϟσϧ

Slide 27

Slide 27 text

" # $ % & ςʔϒϧA ςʔϒϧB ޾ͤͳύλʔϯ Model A Model B

Slide 28

Slide 28 text

" # $ % & ςʔϒϧA ςʔϒϧB ਏ͘ͳΔύλʔϯ Model A × ×

Slide 29

Slide 29 text

ͳͥਏ͘ͳΔͷ͔ ɾ"DUJWF3FDPSE͸ςʔϒϧɾϏϡʔͱର͕લ ఏͷσβΠϯύλʔϯ ɾKPJOલఏͷϝιου͕ଘࡏͨ͠Γ͢Δͱਏ͞ͷ ࢝·Γ ɾۀ຿ϩδοΫ͸ςʔϒϧߏ੒ͱ͸ແؔ܎ʹมԽ ͍ͯ͘͠ ɾΦϒδΣΫτϑΝʔετͳઃܭͱ͸૬ੑ͕ѱ͍ ɾ.Z42-ͷ7*&8͸*OEFYͷ໰୊ͱ͔͋ΔͷͰʜ

Slide 30

Slide 30 text

ɾ࠷େͷϝϦοτͰ΋͋Δ%#ͱີ݁߹ͳ෦ ෼͸ɺಉ࣌ʹ࠷େͷσϝϦοτʹ΋ͳΓ͑Δ ७ਮͳυϝΠϯϞσϧ͕ඞཁʹͳͬͨΒɺ &MPRVFOUͱ͓ผΕ͢Δ߹ਤͳͷ͔΋͠Εͳ ͍ ٽ ɾ͜Ε͸&MPRVFOUͷຊ࣭తͳ෦෼ͱͷ૬ੑ ͷѱ͞

Slide 31

Slide 31 text

·ͱΊ ɾ͍͍ͩͨͷਏ͞͸ɺ࣮૷ͷ޻෉ͰղܾͰ͖Δͱࢥ͏ ɾ࣏҆ͷѱ͍ίʔυΛॻ͔ΕͨΒɺͪΌΜͱϨϏϡʔ Ͱ௚͍ͯ͜͠͏ ɾΫΤϦͷ࠷దԽ͕͖͔ͭͬͨΒ͓ผΕʹͳΔ͔΋͠ Εͳ͍͠ɺ·͊ͳΜͱ͔ͳΔ͔΋͠Εͳ͍ ɾ७ਮͳυϝΠϯϞσϧ͕ཉ͘͠ͳͬͨΒɺଟ෼͓ผ Ε͠ͳ͖Ό͍͚ͳ͍

Slide 32

Slide 32 text

ࢀߟࢿྉ ɾπΠολʔϥϯυͷΈͳ͞Μ ɹIUUQTUPHFUUFSDPNMJ ɾΤϯλʔϓϥΠζΞϓϦέʔγϣϯΞʔΩςΫνϟύλʔϯ ɹIUUQTXXXBNB[PODPKQEQ ɾ/&5ͷΤϯλʔϓϥΠζΞϓϦέʔγϣϯΞʔΩςΫνϟ ɹIUUQTXXXBNB[PODPKQEQ#;2;+/& ɾ-BSBWFM#PJMFSQMBUF ɹIUUQTHJUIVCDPNSBQQBTPGUMBSBWFMCPJMFSQMBUF