NEW
Font size
WorksheetsUntitled Quiz
Total questions: 45
Worksheet time: 23mins
Trong Laravel, Route dùng để làm gì?
Quản lý database
Định tuyến URL đến controller
Hiển thị giao diện
Migrate dữ liệu
Lệnh nào tạo route resource cho API?
Route::resource
Route::apiResource
Route::get
Route::post
Route::apiResource('books', BookController::class) tạo bao nhiêu method?
7
5
3
6
Trong MVC của Laravel, View chịu trách nhiệm:
Xử lý business logic
Hiển thị dữ liệu cho người dùng
Quản lý database
Định tuyến request
Blade template dùng cú pháp nào để in ra biến?
{{ variable }}
<% variable %>
[[ variable ]]
(( variable ))
Lệnh tạo Controller?
php artisan make:model
php artisan controller:create
php artisan make:controller
php artisan new:controller
Trong Laravel, file route API đặt ở đâu?
routes/web.php
routes/api.php
config/routes.php
app/routes/api.php
Lệnh tạo migration?
php artisan migrate:create
php artisan make:migration
php artisan migration:new
php artisan db:migrate
Lệnh chạy migration?
php artisan migrate
php artisan db:run
php artisan migrate:push
php artisan schema:run
Model Eloquent thường nằm ở thư mục nào?
app/Database
app/Models
app/Http/Models
database/models
Book::all() trả về kiểu dữ liệu gì?
JSON
Array thuần
Eloquent Collection
SQL Result
Phương thức dùng để lấy 1 bản ghi theo id?
find()
first()
get()
where() only
Migration dùng để làm gì?
Chỉnh sửa Blade
Định nghĩa cấu trúc DB bằng mã lệnh
Tạo controller
Xử lý logic trong app
Muốn tạo mới record trong Eloquent ta dùng:
Book::add()
Book::insert()
Book::create()
Book::push()
Middleware dùng để làm gì?
Render Blade
Lọc request trước khi vào controller
Lưu vào database
Chạy migration
Lệnh tạo middleware?
php artisan make:middleware
php artisan middleware:new
php artisan create:middleware
php artisan route:middleware
Middleware kiểm tra login tên là gì trong mặc định Laravel?
isLogged
auth
verified
loginCheck
Lệnh cài Laravel Breeze?
composer require laravel/breeze
composer install breeze
php artisan make:auth
php artisan auth:install
Sau khi cài Breeze cần chạy lệnh nào để build frontend?
npm run production
npm run dev
node build
build:frontend
Breeze cung cấp những gì?
Mỗi user role
UI đăng ký, đăng nhập
API CRUD
Tự động deploy
Để tạo bảng users từ Breeze cần chạy:
php artisan migrate
php artisan breeze:migrate
php artisan db:users
php artisan table:users
Aiven dùng để làm gì?
Lưu trữ file
Cung cấp cloud database
Tạo Blade template
Deploy Laravel
Gói Laravel tích hợp Aiven là:
aiven/laravel-database
aiven/aiven-laravel
laravel/aiven
cloud/aiven-db
Lệnh kiểm tra các service của Aiven:
php artisan aiven:check
php artisan aiven:list
php artisan aiven:service
php artisan aiven:get
Lệnh nhận cấu hình DB từ Aiven:
php artisan aiven:connect
php artisan aiven:getconfig
php artisan aiven:database
php artisan aiven:env
Biến môi trường bắt buộc khi dùng Aiven:
DB_MODE
AIVEN_API_TOKEN
AIVEN_KEY
CLOUD_SQL
DB_URL trong môi trường Aiven chứa gì?
địa chỉ Vite
SSH key
Connection string MySQL
Laravel cache
.sslrootcert trong .env dùng để:
Xác thực mã OTP
Kết nối HTTPS
Xác thực chứng chỉ kết nối database
Render HTML
Vite được sử dụng để:
Chạy migration
Build frontend assets (JS, CSS)
Tạo DB cloud
Render Blade
Khi deploy trên Codespace, cần cấu hình lại gì?
Route::prefix
vite.config.js server.hmr
Migration
Model
Biến môi trường trong Codespace lưu hostname là:
CODESPACE_NAME
GITHUB_CODESPACES_PORT_FORWARDING_DOMAIN
VITE_DEV_SERVER_HOST
HOSTNAME
APP_URL dùng để:
Build CSS
Chỉ định domain cho ứng dụng
Lưu tên người dùng
Khai báo Controller
Muốn lấy danh sách book qua API:
GET /books
POST /books
GET /book-list
POST /book/index
Tạo mới book dùng HTTP method nào?
GET
POST
PUT
DELETE
Update book dùng method:
POST
PATCH / PUT
DELETE
OPTIONS
Xóa book dùng method:
POST
GET
DELETE
HEAD
Laravel project mới tạo bằng:
laravel new
composer create-project
php artisan new
composer make:laravel
File .env dùng để:
Luu code PHP
Luu thông tin cấu hình môi trường
Luu giao diện
Luu lịch sử request
Muốn web xử lý HTTPS từ Codespace, cần cấu hình middleware:
handleProxy
trustProxies
routeMiddleware
staticProxies
Public link dùng để:
Chạy lệnh composer
Tạo URL công khai cho tệp trong storage
Debug route
Build vite
php artisan aiven:state --service mysql-xxxxx dùng để:
Kiểm tra migration
Kiểm tra trạng thái service Aiven
Reset database
Sinh API token
Khi chạy Breeze nhưng web không load CSS, nguyên nhân phổ biến nhất?
Sai route
Vite không chạy
Database lỗi
User chưa đăng nhập
Để gán trust proxy '*' trong local cần sửa file:
public/index.php
bootstrap/app.php
config/app.php
server.php
Trong Route của Codespace, vì sao không dùng localhost?
Vì Laravel không hỗ trợ localhost
Vì Codespace dùng domain *.app.github.dev
Vì CORS
Vì nginx lỗi
Khi gọi API /book nhưng bị 404, khả năng cao nhất:
Chưa migrate
Chưa khai báo route trong api.php
Chưa build vite
Chưa connect DB
