• XV. Tạo view cho module Category

    Vào trong folder resources/views và tạo folder categories: Ở folder này thể hiện cơ bản về các chức năng như là xem, sửa, xóa,… Vậy là chúng ta đã tạo ra view cho categories rồi đấy <3.

  • XIV. Tạo master layout

    Chúng ta sẽ vào trong resources/views để tạo 1 folder có tên là layouts: Vậy là chúng ta đã tạo xong view master layouts rồi <3.

  • XII. Tạo ra cotroller CategoryController và PostController

    1.Tạo ra cotroller CategoryController Gõ command line: php artisan make:controller CategoryController Trường hợp chúng ta muốn sử dụng các function có sẵn, chúng ta có thể gõ command line: php artisan make:controller CategoryController -r 2. Tạo ra cotroller PostController Gõ command line: php artisan make:controller PostController Trường hợp chúng ta muốn sử dụng các function […]

  • XI. Sử dụng seeder để tạo table cho 2 table categories và posts

    1 Sử dụng seeder để tạo table cho table categories Gõ command line: php artisan make:seed CategorySeeder Kết quả: Tiếp theo, chúng ta sẽ code để khởi tạo ra các thông tin cần thiết: Code ở trên sử dụng factory mà chúng ta đã tạo ở trang trước, bạn có thể tham khảo ở mục […]

  • X. Sử dụng factory để tạo table cho 2 table categories và posts

    Sử dụng factory để tạo table cho table categories Gõ command line: php artisan make:factory CategoryFactory Kết quả: Tiếp theo, chúng ta sẽ khai báo các phần tử cần thiết: 2. Sử dụng factory để tạo table cho table categories Gõ command line: php artisan make:factory PostFactory Kết quả: Tiếp theo, chúng ta sẽ khai […]

  • VIII. Tạo model cho 2 table categories và posts

    Tạo model cho table categories Gõ command line: php artisan make:model Category Kết quả: 2. Tạo model cho table posts Gõ command line: php artisan make:model Post Kết quả: Vậy là chúng ta đã tạo xong model cho 2 table categories và posts rồi đấy <3.

  • VII. Sử dụng migration để tạo table cho 2 table categories và posts

    Sử dụng migration để tạo table cho table categories Gõ command line: php artisan make:migration create_categories_table –create=categories Kết quả bảng categories đã được khởi tạo: Khởi tạo các phần tử cần thiết trong bảng: 2. Sử dụng migration để tạo table cho table posts Gõ command line: php artisan make:migration create_posts_table –create=posts  Kết quả bảng […]

  • VI. Các lệnh thường được sử dụng với artisan

    Lệnh chạy dự án: php artisan ser Lệnh xóa cache: php artisan config:clear, php artisan optimize, php artisan optimize:clear Lệnh tạo migrations: php artisan make:migration create_name_table Lệnh tạo chạy cơ sở dữ liệu: php artisan db:seed Lệnh tạo factory: php artisan make:factory NameFactory Lệnh tạo model: php artisan make:model Name Lệnh tạo seeder: php artisan […]