Upgrade to Pro
— share decks privately, control downloads, hide ads and more …
Speaker Deck
Features
Speaker Deck
PRO
Sign in
Sign up for free
Search
Search
Laravel5.5のアプデ内容を勝手に評価してみた
Search
kotamat
September 13, 2017
Programming
0
560
Laravel5.5のアプデ内容を勝手に評価してみた
2017-09-13開催されたLaralab vol.1
https://laralab.connpass.com/event/65160
の発表内容です
kotamat
September 13, 2017
Tweet
Share
More Decks by kotamat
See All by kotamat
LLMを用いた対話システムサービスをどうやって立ち 上げていくか? / How to launch a dialogue system service using LLM (Large Language Model)?
kotamat
0
330
ChatGPT×Whisperのプロトタイプと今後の展望 / chatgpt-with-whisper-prototyping-and-future-prospects
kotamat
3
3.2k
プロダクトドリブンにするために行った技術投資 / tech investment for product driven
kotamat
1
760
CTOがなぜPMをやりはじめたのか / Why did the CTO start doing PM
kotamat
0
220
プロダクトを中心に考える#とは / focus on the product
kotamat
1
1.9k
スタートアップに入ってまずやったインフラTIPS
kotamat
2
4.7k
NuxtMeetup#1
kotamat
1
3.1k
Laravel_Nuxtjsでの構成とつまづきポイント
kotamat
1
1k
Laravelでプチマイクロサービスやってみた
kotamat
1
5.4k
Other Decks in Programming
See All in Programming
見せてあげますよ、「本物のLaravel批判」ってやつを。
77web
7
7.8k
Compose 1.7のTextFieldはPOBox Plusで日本語変換できない
tomoya0x00
0
190
Click-free releases & the making of a CLI app
oheyadam
2
120
CSC509 Lecture 12
javiergs
PRO
0
160
macOS でできる リアルタイム動画像処理
biacco42
9
2.4k
Arm移行タイムアタック
qnighy
0
330
Streams APIとTCPフロー制御 / Web Streams API and TCP flow control
tasshi
2
350
Less waste, more joy, and a lot more green: How Quarkus makes Java better
hollycummins
0
100
watsonx.ai Dojo #4 生成AIを使ったアプリ開発、応用編
oniak3ibm
PRO
1
140
最新TCAキャッチアップ
0si43
0
190
What’s New in Compose Multiplatform - A Live Tour (droidcon London 2024)
zsmb
1
480
3rd party scriptでもReactを使いたい! Preact + Reactのハイブリッド開発
righttouch
PRO
1
600
Featured
See All Featured
Docker and Python
trallard
40
3.1k
Building Better People: How to give real-time feedback that sticks.
wjessup
364
19k
Intergalactic Javascript Robots from Outer Space
tanoku
269
27k
I Don’t Have Time: Getting Over the Fear to Launch Your Podcast
jcasabona
28
2k
Fontdeck: Realign not Redesign
paulrobertlloyd
82
5.2k
Rails Girls Zürich Keynote
gr2m
94
13k
Ruby is Unlike a Banana
tanoku
97
11k
Optimizing for Happiness
mojombo
376
70k
Typedesign – Prime Four
hannesfritz
40
2.4k
個人開発の失敗を避けるイケてる考え方 / tips for indie hackers
panda_program
93
16k
Documentation Writing (for coders)
carmenintech
65
4.4k
Code Review Best Practice
trishagee
64
17k
Transcript
-BSBWFMͷ Ξϓσ༰Λউख ʹධՁͯ͠Έͨ !LPUBNBU
ࣗݾհ
ࣗݾհ দຊଠ ·ͭͱ͜͏ͨ גࣜձࣾ4$065&3$50 ۀͷόοΫΤϯυ΄΅-BSBWFM ࣗసं͕͖ !LPUBNBU
ʗ ʗ స৬رͷ༑ਓਓΛ اۀʹհ͠ใुΛಘΒΕΔ $UP#ਓࡐհαʔϏε 4$065&3ͱ
༗ྉ৬ۀհ ਓࡐհձࣾ ϔουϋϯλʔ اۀ ٻ ৬ ऀ ༗ྉ৬ۀհ հͯ͠ใुΛಘΔʹ໔ڐ͕ඞཁ ʹ
4$065&3ͱ ا ۀ స ৬ ऀ εΧλʔ ొऀ ݸਓ͕հͯ͠ใुΛड͚औΕΔ ʹ
ཧղͷ͋Δ૬ஊ૬ख ࣌ؒΛ͔͚ͨҙࢥܾఆ͕Ͱ͖Δ ࠷దͳٻਓΛબͼԠืͰ͖Δ ࠷స৬ऀʹدΓఴͬͨհΛ࣮ݱ 4$065&3ͷར 4$065&3ͷಛ
༰ Ξοϓσʔτͷ༰ΛউखʹධՁ w ධՁ࣠ w ͓ͬײ w ࣮༻ੑ w ˑ˒ͰධՁ
3FTQPOTBCMF ϨεϙϯεΛΫϥεԽͯ͠ఆٛͰ͖Δ ˒˒˒˒ˑ use Illuminate\Contracts\Support\Responsable; class ExampleObject implements Responsable {
public function __construct($name = null) { $this->name = $name ?? 'Teapot'; } public function status() { switch(strtolower($this->name)) { case 'teapot': return 418; default: return 200; } } public function toResponse() { return response( "Hello {$this->name}", $this->status(), ['X-Person' => $this->name] ); } } w UP3FTQPOTFΛ࣮͠ ͨ3FTQPOTBCMFܕΛฦ Γʹ͢Δ͜ͱͰɺҙͷ ϨεϙϯεΛ࣮ݱͰ͖Δɻ w "1*͝ͱʹWJTJCMFઃఆ͠ ͍ͨͱ͖ͱ͔ಛघͳϨεϙ ϯεʹ͍ͨ͠ͱ͖͑Δ ͔ͳʝʁ
#MBEFJG #MBEFͷ!ؔΛಠࣗఆٛͰ͖Δ ˒˒ˑˑˑ w #MBEFJG Λ 4FSWJDF1SPWJEFSCPP U Ͱఆ͓͚ٛͯͩ͘͠Ͱ ༻Մೳ
w !ؔCMBEFͰ༻Մೳ w 1PMJDZͱͷซ༻Ͱ৭ʑ͕ Γͦ͏ɻɻʁ w CMBEFͬͯͳ͍ͱ͍Βͳ͍ use Illuminate\Support\Facades\Blade; Blade::if('admin', function () { return auth()->check() && auth()- >user()->isAdmin(); }); @admin <a href="{{ route('super.secret') }}">Secret Page</a> @else Welcome Guest. <a href="{{ route('login') }}">Login</a> @endadmin
$VTUPN7BMJEBUJPO3VMF όϦσʔγϣϯϧʔϧΛΫϥεԽͯ͠࠶ར༻Մೳʹ ˒˒˒˒ˑ w 3VMFΛ࣮ͨ͠Ϋϥε Λఆٛ͠ɺϧʔϧͷ ʹΠϯελϯεΛ͢ ͚ͩͰϧʔϧઃஔͰ͖ Δ class
CowbellValidationRule implements Rule { public function passes($attribute, $value) { return $value > 10; } public function message() { return ':attribute needs more cowbell!'; } } w ࣄۀυϝΠϯʹґଘ͠ ͨόϦσʔγϣϯΑ ͍͘·Θ͢ͷͰ༗༻
EVNQDPMMFDUJPO DPMMFDUJPOͷϝιουνΣʔϯͷ్தͰதΈΕΔΑ͏ʹ ˒ˑˑˑˑ w ίϨΫγϣϯͷ్தͰ EVNQ ೖΕΕͦͷ్த Λඪ४ग़ྗ͢Δ w EE
ͩͱFYJUͱͳΔ w ։ൃதͩͱ݁ߏ͏͔͠Ε ͳ͍͕ɺMBSBWFMUJOLFSͰ ͍ͩͿࣄΓͦ͏ɻɻ collect([1,2,3])->map(function($i){ return $i * 2; })->dump()->reject(function($i){ return $i < 3; });
1BDLBHF"VUP%JTDPWFSZ BQQQIQมߋ͠ͳͯ͘ύοέʔδ͑Δ ˒˒˒˒˒ w ύοέʔδଆͰࠨهͷΑ͏ͳ ઃఆΛDPNQPTFSKTPOʹ ॻ͍͓͚ͯͩ͘Ͱɺউखʹొ ͞ΕΔɻ w l'PPaa#BSa
a4FSWJDF1SPWJEFSJT OPUGPVOEzࠈ͔Β։์ ͞ΕΔɻɻʂ "extra": { "laravel": { "providers": [ "Foo\\Bar\\ServiceProvider" ], "aliases": { "Bar": "Foo\\Bar\\Facade" } } }
8IPPQT ؼ͖ͬͯͨ8IPPQT ˒˒˒˒˒ w ΤϥʔϋϯυϦϯάΛ͖Ε͍ ʹදࣔ w *%&༻ʹϦϑΝϨϯεΛදࣔ w ग़ྗϑΥʔϚοτΛબͰ͖
Δ +40/ 9.- 40"1 w ֦ு͕༰қ
UISPX@JGIFMQFS CPPMఆͰྫ֎͛Δϔϧύʔ ˒˒˒˒ˑ w ΄΅λΠτϧ௨ΓͰ͆͢ w &YDFQUJPO)BOEMFSͰϨ εϙϯεఆ͍ٛͯ͠Δ߹ ͑Δ͔ $foo
= true; throw_if($foo, new BarException('Foo is true')); // or throw_if($foo, BarException::class, 'Foo is true');
7BMJEBUJPOSFUVSOTSFRVFTUEBUB 7BMJEBUJPOͰఆٛͨ͠ϑΟʔϧυzͷΈzσʔλநग़ͯ͠ ฦ͢ ˒˒˒˒˒ w SFRVFTU POMZ Λ Θͳͯ͘Α͘ͳͬͨɻ w
όϦσʔγϣϯϧʔϧແ͠Ͱ σʔλΛड͚औΓ͍ͨ߹ ۭจࣈͰϧʔϧΛࢦఆ͢Δɻ w ؔ৺͕ڽॖ͞ΕΔͷͰ $data = $this->validate(request(), [ 'name' => 'required', 'price' => 'required|numeric', 'notRequiredField' => '', ]); // $data = request()->only('name', 'price', 'category_id');
'SPOUFOEQSFTFUT BSUJTBOίϚϯυͰKTϑϨʔϜϫʔΫ؆୯ઃஔ ˒ˑˑˑˑ w 3FBDU CPPUTUSBQ 7VFKTΛઃஔͰ͖ΔΑ͏ʹ w ਖ਼࠷ॳ͔͠Θͳ͍ʝ
php artisan preset react|bootstrap
.JHSBUF'SFTI$PNNBOE શςʔϒϧΛ%SPQ͔ͯ͠ΒϚΠάϨʔγϣϯ࣮ߦ ˒˒˒˒˒ w SFGSFTIͱҧ͍ϩʔϧ όοΫ͠ͳ͍ͷͰɺݱঢ়ͷ%# ঢ়گԿʹΑͬͯϚΠάϨʔ γϣϯ͕ࣦഊ͠ͳ͍ w ຊ൪%#ΛϛϥʔϦϯάͯ͠
εςʔδϯά%#Λ͍ͬͯ ΔϓϩδΣΫτͰ༗༻ php artisan migrate:fresh
&NBJM5IFNFTJO.BJMBCMFT ϝʔϧςϯϓϨʔτΛ؆୯ʹઃఆՄೳʹ ˒˒ˑˑˑ w .BJMBCMFͷΫϥεͰ UIFNFΛࢦఆͰ͖ΔΑ ͏ʹ w DPOGJH bNBSLEPXOQBUIT`
<DPOGJH bNBSLEPXOUIFNF` > ʹࢦ ఆ͞ΕͨDTTΛಡΈࠐΉ w ෳͷαʔϏεΛ࣮ߦ class SendInvoice extends Mailable { protected $theme = 'my-theme'; ... }
.BJMBCMFTSFOEFSUPCSPXTFS ϝʔϧจ໘ΛϒϥβͰ֬ೝͰ͖ΔΑ͏ʹ ˒˒˒˒˒ w 3FOEFSBCMFΛܧঝͨ͠Ϋϥε Ͱ͋ΕɺϨεϙϯεʹΠϯελ ϯε͚ͩ͢ͰϒϥβνΣοΫ Մೳʹ w ࠓ·ͰNBJMDBUDIFSͳͲͰ
ϝʔϧඈͨ͠Γ͍ͯͨ͠ͷͰɺ σβΠϯमਖ਼͍ͩͿָʹ Route::get('/demo', function () { return new App\Mail\UserWelcome(); });
WFOEPSQVCMJTI1SPWJEFSQSPNQU WFOEPSQVCMJTI࣮ߦ࣌༻͢Δ1SPWJEFSΛબ͢Δ Α͏ʹ ˒˒ˑˑˑ w WFOEPSQVCMJTI࣮ߦ࣌શ෦ QVCMJTI͞ΕΔͷΛ͙ w ։ൃ࣌ϓϥάΠϯͷνΣοΫͰ ͑Δͱࢥ͏͚Ͳɺ࣮ӡ༻࣌
UBHIPHFͰࢦఆ͢ΔͷͰɺͦΕ ΄ͲԸܙͳ͍͔ͳ͊ɻɻ
NBLJOH.PEFM'BDUPSZ NPEFMGBDUPSZΛBSUJTBOίϚϯυͰੜՄೳʹ ˒ˑˑˑˑ w ίϚϯυҰൃͰNPEFMGBDUPSZ ͕ੜՄೳ w ͨͩɺੜ͞ΕΔͷ͕ɺۭͷͷ ͳͷͰɺਖ਼SZNBOBMV GBDUPSZHFOFSBUPSͰ.PEFM
ͷGJMMBCMFΛఆͯࣗ͠ಈੜ ͢Δ΄͏͕͍উख͕͍͍ɻɻ php artisan make:factory UserFactory
·ͱΊ -BSBWFM։ൃޮˢͷόʔδϣϯ w ϩʔΧϧͰͷΈҙຯ͕͋ΔPS։ൃޮ্͛ΔΑ͏ͳΞοϓσʔ τ͕ओͩͬͨɻ w -BSBWFM͕XFC։ൃͷϑϨʔϜϫʔΫͷಓΛಥ͖ਐΜͰ͍Δҹ ͦͦͦ͏͍͏ཱ͚͚ͯͩͲ
w ٕज़తʹഁյతʹ໘ന͍Ξοϓσʔτͱݴ͏ײ͡Ͱͳ͔ͬͨʝ w -54خ͍͠ DPNQPTFSDSFBUFMBSBWFMMBSBWFM QIQBSUJTBOTFSWF ૣͬͯΈΑ͏