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
Laravel Offline Sharing (March 2023) at Ho Chi Minh City, Vietnam
Search
Dinh Quoc Han
March 25, 2023
Technology
0
24
Laravel Offline Sharing (March 2023) at Ho Chi Minh City, Vietnam
Dinh Quoc Han
March 25, 2023
Tweet
Share
More Decks by Dinh Quoc Han
See All by Dinh Quoc Han
Laravel Vietnam Meetup 2022: Your code is simplify or complexity?
dinhquochan
0
93
Laravel Live Vietnam 2022: Laravel Eloquent Performance
dinhquochan
0
37
Other Decks in Technology
See All in Technology
CEL(Common Expression Language)で書いた条件にマッチしたIAM Policyを見つける / iam-policy-finder
fujiwara3
0
710
テストケースの自動生成に生成AIの導入を試みた話と生成AIによる今後の期待
shift_evolve
0
180
dxd2024-生成AIに振り回された3か月間の成功と失敗/dxd2024-link-and-motivation
lmi
2
260
CTOから見た事業開発とプロダクト開発 / My Perspective on Business and Product Development as CTO
keisuke69
4
960
What is DRE? - Road to SRE NEXT@広島
chanyou0311
3
620
AOAI Dev Day LLMシステム開発 Tips集
hirosatogamo
15
3.6k
20240725 LLMによるDXのビジョンと、今何からやるべきか @Azure OpenAI Service Dev Day
nrryuya
3
1.1k
AWS IAMのアンチパターン/AWSが考える最低権限実現へのアプローチ概略(JAWS-UG朝会#59資料改修20分版)
htan
0
330
頼られるのが大好きな 皆さんへ - 支援相手との期待の合わせ方、突き放し方 -/For_people_who_like_to_be_relied_on
naitosatoshi
1
290
開発生産性をむしろ向上させる セキュリティパートナーの作り方 / Dev Productivity Con 2024
flatt_security
0
360
「我々はどこに向かっているのか」を問い続けるための仕組みづくり / Establishing a System for Continuous Inquiry about where we are
daitasu
0
170
[NIKKEI Tech Talk] KDDI/KAG Scrum & Community for Engineering Training
curanosuke
2
220
Featured
See All Featured
Mobile First: as difficult as doing things right
swwweet
219
8.8k
The Cult of Friendly URLs
andyhume
75
5.9k
Faster Mobile Websites
deanohume
303
30k
Practical Orchestrator
shlominoach
185
10k
For a Future-Friendly Web
brad_frost
173
9.2k
Fontdeck: Realign not Redesign
paulrobertlloyd
79
5.1k
A Tale of Four Properties
chriscoyier
155
22k
Six Lessons from altMBA
skipperchong
24
3.2k
Web development in the modern age
philhawksworth
203
10k
Become a Pro
speakerdeck
PRO
15
4.8k
Designing Dashboards & Data Visualisations in Web Apps
destraynor
226
52k
Keith and Marios Guide to Fast Websites
keithpitt
408
22k
Transcript
Laravel Việt Nam - 19 Tháng 3, 2023 Laravel Offline
Sharing Hồ Chí Minh, Việt Nam
Được Tổ Chức Bởi Laravel Việt Nam
Nhà Tại Trợ Địa Điểm
Lịch trình sự kiện • TechTalk 😎 • Các cấu
trúc thường gặp khi triển khai ứng dụng trên Laravel • Những cách triển khai nghiệp vụ logic phổ biến trên Laravel • Triển khai dynamic route trong Laravel • … • Beer Party 🥳
Discuss; Sharing TL;DR
1. Các bạn thường cấu trúc ứng dụng Laravel như
thế nào?
“Cho sao để vậy, thay đổi chi?” Giữ Nguyên
Không có gì phải bàn 🥲
“Phá luật thì lúc nào cũng sẽ vui hơn tí
:)” Bóc Tách
App in App Design
None
None
None
Packages Design
None
Đọc kỹ HDSD trước khi dùng https://laravel.com/docs/10.x/packages
None
None
None
CMS-like & Plugins/Addons
Botble CMS
None
Plugins Loader & Theme Loader
Domain-oriented Design
Domain-driven Design • Application • Domain • Infrastucture • Interface
(UI)
None
Tham khảo mô hình hướng miền https://github.com/qh-8/skeleton
…
Vậy có nên thay đổi cấu trúc mặc định khi
triển khai ứng dụng?
Nên hoặc không tùy vào quy mô ứng dụng của
bạn
Q&A “Giải lao tí trước khi vào section 2 nha
các bạn 🥶”
2. Triển khai logic trong Laravel
- một ai đó đã từng nói vậy và tôi
thấy nó đúng “Controller không nên chứa bất kỳ nghiệp vụ logic nào.”
“chỗ này năm ngoái (2022) mình có nói rồi hihi”
Tại Sao?
Fat model & Thin controller
$user->changePassword($request->input(‘password’)); “Dễ nhất, nhanh nhất, gọn nhất. Cái gì khó
để model lo, controller gọi là xong 😅”
None
Service Classes
$userService->create($userStoreRequest); “Đại khái là gom cụm tính năng của 1
thằng vô 1 lớp.” $userService->update($currentUser, $userUpdateRequest);
None
Action/Command Classes
$createUser->handle($userStoreRequest); “Tách riêng từng nghiệp vụ một thành 1 lớp.”
$updateUser->handle($currentUser, $userUpdateRequest);
None
None
“Nhớ tận dụng dependency injection & service container của Laravel”
“Sẵn tiện giải lao vài phút trước khi vào phần
3 nha 🥹” Còn bạn?
3. Triển khai thực tiễn tính năng dynamic route trong
Laravel
Đặt vấn đề
SlugHandlerManager
/blog/abc-xyz-123 SlugController SlugHandlerManager BlogSlugHandler
Database Scheme
None
Hình dung cách sử dụng
None
SlugController
None
None
Create interfaces
None
None
Implementation
None
None
None
/sp/{year}/{month}/{name}-{id}.html
`findHandler(…)`
Template Regexr Find Handler
None
… đa ngôn ngữ 🤪
Hết
Q&A / Sharing
Cảm ơn mọi người đã lắng nghe và chia sẻ
Thanks