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
graphql in laravel(lighthouse-php)
Search
Sponsored
·
SiteGround - Reliable hosting with speed, security, and support you can count on.
→
qazz92
February 21, 2020
Programming
0
200
graphql in laravel(lighthouse-php)
Graphql in laravel
by Comento
qazz92
February 21, 2020
Tweet
Share
Other Decks in Programming
See All in Programming
360° Signals in Angular: Signal Forms with SignalStore & Resources @ngLondon 01/2026
manfredsteyer
PRO
0
130
16年目のピクシブ百科事典を支える最新の技術基盤 / The Modern Tech Stack Powering Pixiv Encyclopedia in its 16th Year
ahuglajbclajep
5
1k
AgentCoreとHuman in the Loop
har1101
5
240
AIエージェントのキホンから学ぶ「エージェンティックコーディング」実践入門
masahiro_nishimi
5
470
AIと一緒にレガシーに向き合ってみた
nyafunta9858
0
240
React 19でつくる「気持ちいいUI」- 楽観的UIのすすめ
himorishige
11
7.4k
KIKI_MBSD Cybersecurity Challenges 2025
ikema
0
1.3k
Grafana:建立系統全知視角的捷徑
blueswen
0
330
プロダクトオーナーから見たSOC2 _SOC2ゆるミートアップ#2
kekekenta
0
220
今こそ知るべき耐量子計算機暗号(PQC)入門 / PQC: What You Need to Know Now
mackey0225
3
380
フロントエンド開発の勘所 -複数事業を経験して見えた判断軸の違い-
heimusu
7
2.8k
Architectural Extensions
denyspoltorak
0
290
Featured
See All Featured
Imperfection Machines: The Place of Print at Facebook
scottboms
269
14k
BBQ
matthewcrist
89
10k
Exploring the Power of Turbo Streams & Action Cable | RailsConf2023
kevinliebholz
37
6.3k
A Guide to Academic Writing Using Generative AI - A Workshop
ks91
PRO
0
210
Fantastic passwords and where to find them - at NoRuKo
philnash
52
3.6k
Odyssey Design
rkendrick25
PRO
1
500
VelocityConf: Rendering Performance Case Studies
addyosmani
333
24k
Groundhog Day: Seeking Process in Gaming for Health
codingconduct
0
93
Balancing Empowerment & Direction
lara
5
890
The Cost Of JavaScript in 2023
addyosmani
55
9.5k
Prompt Engineering for Job Search
mfonobong
0
160
Raft: Consensus for Rubyists
vanstee
141
7.3k
Transcript
ݭష - ۾ With Laravel
RESTful API ?
RESTful API Method Route Action GET /post Ӗ ݾ۾ ੍ӝ
GET /post/:id ౠ Ӗ ੍ӝ POST /post Ӗ PUT/PATCH /post/:id Ӗ DELETE /post/:id Ӗ ઁ
RESTful API
ೞ݅…അपীࢲח… RESTful API Ex) Ӗਸ ઁೞݶ ನੋܳ غج۰Ҋ रযਃ! Ѥ
put ੋоਃ / delete ੋоਃ?
RESTful API
RESTful API GET /post/:id GET /comment/:postId GET /like/:postId
RESTful API GET /postAndCommentsAndLikes/:id
RESTful API Ӓؘ۠..
RESTful API ݽ߄ੌীࢲ ܲ Ѧ ୶оਵ۽ ࠁৈঠ ೠѢա, ࡐঠ ೠݶ?
=> /postAndCommentsAndLikes/:id?platform=mobile э api ܳ ܲ Ҕীࢲ ࢎਊ ೧ঠ ೞחؘ ӂೠ ୶оغযঠ ೠݶ? э api ܳ ܲ Ҕীࢲ ࢎਊ ೧ঠ ҙ҅о ୶о غঠ ೠݶ? …
RESTful API front-end ‘ apiীࢲ ݭష ࠁө ࣁਃ.’ back-end GET
/edu/camp/:id?mentor=1 ӝദ ‘ই! ݽ߄ੌীࢲח ࣗܳ ࡐࣁਃ’ front-end back-end ‘….’ front-end ٘ ࣻ back-end GET /edu/camp/:id?mentor=1&location=0 front-end ٘ ࣻ back-end ޙࢲ ١ সؘ back-end front-end ழޭפா࣌ ࠺ਊ ֫
RESTful API
None
GraphQL ױ ೠ ѐ end-point ೧ ௪ܻ झಖ(Schema)ী ٮۄ, ۄо
db ഐ!
front-end ‘ apiীࢲ ݭష ࠁ?’ front-end { camp(id: 214) {
mentor { name company } title back_img } } front-end ٘ ࣻ ࢲߡীࢲח ௪ܻ झಖ݅ ઓ! ৻ࠗ झಖա ޙࢲী ઓ X ழޭפா࣌ ࠺ਊ хࣗ GraphQL
GraphQL - Basic Query Mutation read data write data Type
model type user { id: ID! email: String! pw: String! } query { user(id: 1) { id email } } mutation { creaetUser ( email: "
[email protected]
" pw: “test” ) { id } }
GraphQL ଵ જؘ…Laravel ীࢲ যڌѱ ॳ…?
GraphQL Lighthouse-php https://lighthouse-php.com/
GraphQL Lighthouse-php ৵? ࠁా apollo! but ࢲߡ ҙܻ ӈଳ ?
eloquent ORM! ױ? ࠂೠ ௪ܻܳ ࢎਊೞ۰ݶ ѾҴ schema ৻ স ਃ
GraphQL Lighthouse-php with EloquentORM Example 1. Type type User
{ id: ID! email: String! type: Int! } Eloquent ORM ݽ؛җ ڙэ ࢿ
GraphQL Lighthouse-php with EloquentORM 2. Read type Query { user(id:
ID! @eq) : User! @find } 2-1. ױੌ ઑഥ => select * from user where id = :id limit 1 Example
GraphQL Lighthouse-php with EloquentORM type Query { user(id: ID! @eq)
: User! @find } ઑѤਸ ೲਊೡ ஸۢҗ ఋੑ where ‘=’ ߈ജ ఋੑ ->first()
GraphQL Lighthouse-php with EloquentORM 2. Read type Query { user(type:
Int! @eq) : [User!]! @all } 2-2. ܻझ ઑഥ => select * from user where type = :type Example
GraphQL Lighthouse-php with EloquentORM ߈ജ ఋੑ ( ߓৌ )
type Query { user(type: Int! @eq) : [User!]! @all } ->get() ઑѤਸ ೲਊೡ ஸۢҗ ఋੑ where ‘=’
GraphQL Lighthouse-php with EloquentORM 2. Read type Query { user(type:
Int! @eq) : [User!]! @pagination } 2-2. ܻझ ઑഥ (ಕ֎࣌) => select * from user where type = :type offset :offset limit :limit Example
GraphQL Lighthouse-php with EloquentORM 3. Middleware type Query { user(type:
Int! @eq) : [User!]! @pagination @middleware(checks: ["auth:api"]) } Example
GraphQL Lighthouse-php with EloquentORM 4. Muatation type Muatation { createUser(
email: String! pw: String! ) : User! @create } @create, @update, @delete, @upsert(updateOrCreate) Example
GraphQL Lighthouse-php with EloquentORM 5. Eloquent Relationships Example type Post
{ id: ID! email: String! type: Int! Author: User! @belongsTo(relation: “user”) } class User extends Model { …… public function user() { return $this->belongsTo(User::class) } } => Model ҙ҅৬ ܴਸ ڙэ যષ @hasOne, @hasMany, @belongsToMany, @belongsTo
GraphQL Lighthouse-php with EloquentORM query { post(no : 1) {
no title user { email } } } { "data": { "post": { "no": “1", "title": “test", "user": { “email": "5" } } } } =>
GraphQL Lighthouse-php with EloquentORM 6. Event Example type Muatation {
createUser( email: String! pw: String! ) : User! @create @event(dispatch: "App\\Events\ \CreateUserEvent") } Event direction ਸ ాೞৈ query / mutation റ ݫੌ ࣠ ١ ৈ۞ ೯زٜਸ ೡ ࣻ ѱ ࢸ ೡ ࣻ laravel events class
GraphQL Lighthouse-php with EloquentORM ৻ীب ৈ۞о directiveٜਸ ઑೞৈ ௪ܻ оמ
GraphQL ੋ۽झಖ࣌ RestAPI ীࢲח API ݺࣁࢲо ਃ GraphQL ੋ۽झಖ࣌ਵ۽
೧Ѿ
GraphQL नӏ दझమী ਊ Ѿҗ ੌ যٚ!
GraphQL नӏ दझమী ਊ Ѿҗ ਗې flow controller / service
/ repository => route ١۾ => response ҳઑ ҕਬ(ޙࢲ) => ೖ٘ߔ => ޖೠ ߈ࠂ ՙীীীীু!
GraphQL नӏ दझమী ਊ Ѿҗ ߸҃ flow झః݃ ࢿ =>
! PROFIT!