Bài 11) |-------------------------------------------------------------------------- */ // ========================================================================= // BÀI TẬP 01: Trang chào mừng mặc định của dự án Lab01_Framework // ========================================================================= Route::get('/', function () { return view('welcome', [ 'projectName' => 'Lab01_Framework', 'laravelVer' => '10.x', 'phpVer' => PHP_VERSION, ]); })->name('home'); // ========================================================================= // BÀI TẬP 02: Các Route cơ bản (/hello, /time, /sum/{a}/{b}) // ========================================================================= Route::get('/hello', function () { return 'Xin chào! Chào mừng bạn đến với Laravel Framework (Lab01_Framework)!'; })->name('hello'); Route::get('/time', function () { return 'Thời gian hiện tại (Carbon): ' . now()->format('d/m/Y H:i:s'); })->name('time'); Route::get('/sum/{a}/{b}', function (int $a, int $b) { $tong = $a + $b; return "Tổng của {$a} và {$b} là: {$tong}"; })->whereNumber(['a', 'b'])->name('sum'); // ========================================================================= // BÀI TẬP 03 -> 06, 08, 09, 10: Quản lý Sinh viên (StudentController) // ========================================================================= // Bài 03: Hiển thị danh sách sinh viên từ mảng tĩnh Route::get('/students/static', [StudentController::class, 'staticIndex'])->name('students.static'); // Bài 04, 05, 06, 09, 10: Hiển thị danh sách sinh viên từ CSDL (Eloquent + Paginate + Filter) Route::get('/students', [StudentController::class, 'index'])->name('students.index'); // Bài 05: Giao diện 2 Tab so sánh nguồn dữ liệu (Array vs Eloquent) Route::get('/students/compare', [StudentController::class, 'compare'])->name('students.compare'); // Bài 08: Form thêm mới sinh viên (@csrf + Validation) Route::get('/students/create', [StudentController::class, 'create'])->name('students.create'); Route::post('/students', [StudentController::class, 'store'])->name('students.store'); // ========================================================================= // BÀI TẬP 07: Trang "Giới thiệu khóa học" (/about) // ========================================================================= Route::get('/about', [PageController::class, 'about'])->name('pages.about');