'01', 'dir' => 'Bai01', 'title' => 'Khởi tạo dự án Laravel Lab01_Framework & Trang chào mừng (/)', 'badge' => 'Installation & Setup', 'color' => 'danger', 'desc' => 'Cài đặt dự án Laravel qua Composer / Laragon, cấu hình .env, chạy php artisan serve và kiểm tra Route mặc định (/).', 'files' => ['composer.json', '.env.example', 'artisan', 'routes/web.php'], ], [ 'num' => '02', 'dir' => 'Bai02', 'title' => 'Tạo các Route cơ bản (/hello, /time, /sum/{a}/{b})', 'badge' => 'Routing & Carbon', 'color' => 'primary', 'desc' => 'Định nghĩa Route trả về chuỗi lời chào, thời gian thực bằng Carbon now() và tính tổng 2 tham số trên URL kèm form thử nghiệm.', 'files' => ['routes/web.php'], ], [ 'num' => '03', 'dir' => 'Bai03', 'title' => 'StudentController & View Blade hiển thị mảng tĩnh sinh viên', 'badge' => 'Controller & Blade', 'color' => 'success', 'desc' => 'Tạo StudentController@index, truyền mảng tĩnh sinh viên sang view students/index.blade.php kế thừa layouts/app.blade.php.', 'files' => ['app/Http/Controllers/StudentController.php', 'resources/views/layouts/app.blade.php', 'resources/views/students/index.blade.php'], ], [ 'num' => '04', 'dir' => 'Bai04', 'title' => 'Model, Migration, Factory, Seeder & Eloquent ORM + Phân trang', 'badge' => 'Eloquent & Paginate(5)', 'color' => 'info', 'desc' => 'Tạo bảng students, gieo 10 bản ghi mẫu bằng StudentSeeder/StudentFactory và truy vấn từ MySQL kết hợp phân trang paginate(5).', 'files' => ['Bai04/students.sql', 'app/Models/Student.php', 'database/migrations/2026_01_01_000001_create_students_table.php', 'database/factories/StudentFactory.php', 'database/seeders/StudentSeeder.php'], ], [ 'num' => '05', 'dir' => 'Bai05', 'title' => 'So sánh 2 nguồn dữ liệu: Mảng tĩnh (Array) vs CSDL (Eloquent)', 'badge' => 'Array vs Eloquent', 'color' => 'warning', 'desc' => 'Xây dựng giao diện 2 Tab trực quan đối chiếu dữ liệu lấy từ Mảng tĩnh PHP và dữ liệu truy vấn từ MySQL qua Eloquent ORM.', 'files' => ['Bai05/students.sql', 'app/Http/Controllers/StudentController.php', 'resources/views/students/index.blade.php'], ], [ 'num' => '06', 'dir' => 'Bai06', 'title' => 'Blade Directive (@class, @selected) & Component ', 'badge' => 'Blade Components', 'color' => 'secondary', 'desc' => 'Áp dụng @class tô màu dòng, @selected giữ trạng thái bộ lọc giới tính và tạo Component gắn nhãn Adult / Under 18.', 'files' => ['app/View/Components/Badge.php', 'resources/views/components/badge.blade.php', 'resources/views/students/index.blade.php'], ], [ 'num' => '07', 'dir' => 'Bai07', 'title' => 'Trang "Giới thiệu khóa học" (/about - PageController@about)', 'badge' => 'MVC Page', 'color' => 'dark', 'desc' => 'Tạo PageController@about và view resources/views/pages/about.blade.php kế thừa layout chung của ứng dụng.', 'files' => ['app/Http/Controllers/PageController.php', 'resources/views/pages/about.blade.php', 'routes/web.php'], ], [ 'num' => '08', 'dir' => 'Bai08', 'title' => 'Form thêm Sinh viên mới với bảo vệ CSRF (@csrf) & Validation', 'badge' => 'CSRF & Validation', 'color' => 'success', 'desc' => 'Tạo form thêm sinh viên mới có token @csrf, kiểm tra hợp lệ (name, email, age, gender) và lưu trực tiếp vào bảng students.', 'files' => ['Bai08/students.sql', 'app/Http/Controllers/StudentController.php', 'resources/views/students/create.blade.php'], ], [ 'num' => '09', 'dir' => 'Bai09', 'title' => 'Migration bổ sung cột class_name & Seed lại dữ liệu', 'badge' => 'Schema Alter & Seed', 'color' => 'primary', 'desc' => 'Tạo migration add_class_name_to_students_table thêm cột class_name, tự động ALTER TABLE trên MySQL và cập nhật dữ liệu mẫu.', 'files' => ['Bai09/add_class_name.sql', 'database/migrations/2026_01_01_000002_add_class_name_to_students_table.php', 'database/seeders/StudentSeeder.php'], ], [ 'num' => '10', 'dir' => 'Bai10', 'title' => 'Tạo Component & Tách Partial partials/header.blade.php', 'badge' => 'UI Modularization', 'color' => 'info', 'desc' => 'Tái cấu trúc giao diện thành các khối độc lập với có slot tiêu đề/nội dung và @include(\'partials.header\').', 'files' => ['app/View/Components/Card.php', 'resources/views/components/card.blade.php', 'resources/views/partials/header.blade.php'], ], [ 'num' => '11', 'dir' => 'Bai11', 'title' => 'Kiểm thử tự động với PHPUnit (HelloRouteTest)', 'badge' => 'PHPUnit Feature Test', 'color' => 'danger', 'desc' => 'Viết Feature Test kiểm tra Route /hello trả về HTTP 200 OK và mô phỏng trình chạy php artisan test trực quan.', 'files' => ['tests/Feature/HelloRouteTest.php', 'routes/web.php'], ], ]; ?> Chương 4 / Lab 6: Laravel Framework - Giới thiệu và Cài đặt
CHƯƠNG 4 • LAB 06

LARAVEL FRAMEWORK - GIỚI THIỆU VÀ CÀI ĐẶT

Dự án mẫu Lab01_Framework — Đầy đủ cấu trúc chuẩn Laravel 10.x và 11 bài thực hành tương tác trực tiếp

Danh sách 11 Bài tập Thực hành (Lớp 2)

Cấu trúc Dự án Laravel (Lớp 1)

Lab06_Laravel_GioiThieu/
├── app/
│   ├── Http/Controllers/
│   │   ├── PageController.php
│   │   └── StudentController.php
│   ├── Models/
│   │   └── Student.php
│   └── View/Components/
│       ├── Badge.php
│       └── Card.php
├── database/
│   ├── factories/
│   │   └── StudentFactory.php
│   ├── migrations/
│   │   ├── 2026_01_01_000001_create_students_table.php
│   │   └── 2026_01_01_000002_add_class_name_to_students_table.php
│   └── seeders/
│       ├── DatabaseSeeder.php
│       └── StudentSeeder.php
├── resources/views/
│   ├── components/
│   │   ├── badge.blade.php
│   │   └── card.blade.php
│   ├── layouts/
│   │   └── app.blade.php
│   ├── pages/
│   │   └── about.blade.php
│   ├── partials/
│   │   └── header.blade.php
│   └── students/
│       ├── create.blade.php
│       └── index.blade.php
├── routes/
│   └── web.php
├── tests/Feature/
│   └── HelloRouteTest.php
├── .env.example
├── artisan
├── composer.json
├── lab06_database.sql
└── Bai01/ ... Bai11/