Based on course: https://www.youtube.com/watch?v=AEVhR-hD2Wk
- as a user, I want to create item for a todo list
- as a user, I want to mark items as complete and not to see them
- as a user, I want to see completed items
- as an admin, I want to see all items in MySQL database
- Install laravel environment: https://laravel.com/docs/4.2
- Install MySQL DB: https://dev.mysql.com/downloads/mysql/
- use the username 'root' and password '1234'
- Create laravel project: composer create-project laravel/laravel todoList
- Create local db
- Set db in .env file:
- DB_DATABASE=todoList
- DB_USERNAME=root
- DB_PASSWORD=1234
- Making model ListItem, Create migration
- Create model: php artisan make:model ListItem -m
- Make migration: php artisan migrate
- Check the migration folder: _database/migrations
- Delete all except of: /xxx_create_list_items_table.php_
- Add to migration file another columns:
- $table->sting('name');
- $table->integer('is_complete');
- Make migration again: php artisan migrate
- Make sure it is added to db
- Make factory for seeders: php artisan make:factory ListItem
- Refresh migration: php artisan migrate:fresh
- Refresh migration includes generate test info (seeds): php artisan migrate:fresh --seed
- Creating controller for free from logic file web.php: php artisan make:controller TodoListController
- Starting the server: php artisan serve
- Open http://127.0.0.1:8000/
- Show routes: php artisan route:list
- Changed files:
- Rename welcome.blade.php to mainPage.blade.php.
- resources/views/mainPage.blade.php
- Http/Controllers/TodoListController.php
- .env
- database/migrations/2023_09_09_122035_create_list_items_table.php
- routes/web.php