ทบทวน แล้วติดตั้ง laravel-admin
https://laravel-admin.org/docs/#/
ติดตั้ง xampp php7
php -v (PHP 7.2.26)
composer -V (1.9.1 2019-11-01 17:20:17)
php artisan -V (Laravel Framework 7.16.1)
DOS>node -v (v10.15.3)
DOS>npm -v (6.4.1)
DOS>npx -v (6.4.1)
mysql_start.bat
cd c:\xampp\mysql\bin
mysql -u root
use test;
drop table categories;
drop table a,b,c;
ลบทุกตารางที่ไม่ได้ใช้
show tables;
exit;
composer create-project --prefer-dist laravel/laravel la1 (8,001 Files, 1,470 Folders, 36.2 MB)
cd la1
php artisan -V (Laravel Framework 7.17.1)
php artisan serve (no login)
composer require laravel/ui (8,050 Files, 1,487 Folders, 36.3 MB)
php artisan ui vue --auth
npm install && npm run dev (22,827 Files, 4,122 Folders, 139 MB)
# แก้ไขแฟ้ม c:\xampp\htdocs\la1\.env
```
DB_DATABASE=test (DB_DATABASE=laravel)
DB_USERNAME=root
DB_PASSWORD=
```
php artisan migrate (ถ้าไม่เปลี่ยนใน .env จาก laravel เป็น test จะ error : Illuminate\Database\QueryException)
Migration table created successfully.
Migrating: 2014_10_12_000000_create_users_table
Migrated: 2014_10_12_000000_create_users_table (0.45 seconds)
Migrating: 2014_10_12_100000_create_password_resets_table
Migrated: 2014_10_12_100000_create_password_resets_table (0.31 seconds)
Migrating: 2019_08_19_000000_create_failed_jobs_table
Migrated: 2019_08_19_000000_create_failed_jobs_table (0.23 seconds)
c:\xampp\mysql\bin\mysql -u root
use test;
show tables; (failed_jobs, migrations, password_resets, users)
php artisan serve (Login + Register)
register ด้วย one@hotmail.com 11111111 พบว่า ลงทะเบียน ออกระบบ เข้าระบบ ได้
http://127.0.0.1:8000 (Ctrl+C)
composer require encore/laravel-admin (23,996 Files, 4,333 Folders, 146 MB)
php artisan vendor:publish --provider="Encore\Admin\AdminServiceProvider"
notepad la1/config/admin.php (ดูเฉย ๆ ไม่ได้แก้ไขอะไร)
php artisan admin:install (24,303 Files, 4,426 Folders, 150 MB)
in mysql : show tables; (admin_menu, admin_operation_log, admin_permissions, admin_role_menu, admin_role_permissions, admin_role_users, admin_roles, admin_user_permissions, admin_users)
php artisan serve
http://localhost:8000/ (ok not change)
http://localhost:8000/admin (user: admin password:admin)
http://localhost:8000/admin/auth/users (new nation:nation administrator)
logout + login by nation (new burin:burin administrator)
---
composer require appzcoder/crud-generator --dev (24,414 Files, 4,448 Folders, 150 MB)
# https://libraries.io/github/ChangePlaces/crud-generator
php artisan vendor:publish --provider="Appzcoder\CrudGenerator\CrudGeneratorServiceProvider"
# http://www.thaiall.com/project/projectdbnwind.htm
php artisan crud:generate Categories --fields="categoryid#integer; categoryname#string; description#text" --view-path=northwind --controller-namespace=northwind --route-group=northwind --form-helper=html
Controller created successfully.
Model created successfully.
Migration created successfully.
View created successfully.
Crud/Resource route added to C:\xampp7\htdocs\la1\routes/web.php
DOS> php artisan route:list มีให้เรียกใช้เยอะเลย
DOS> php artisan migrate
DOS> php artisan serve
http://127.0.0.1:8000/northwind/categories
apache_start.bat (แก้ไข DocumentRoot กับ Directory ใน httpd.conf ไปที่ la1/public)
http://127.0.0.1/northwind/categories
เพิ่ม food, drink, dessert ไปแล้ว
ปรับ welcome.blade.php in la1/resources/views/ เพิ่มลิงค์ Categories กับ Admin page และใน "top-right links"
ปรับ app.blade.php in la1/resources/views/layouts/ เพิ่มลิงค์ thaiall.com หน้าแรก
---
la1_7.17.1_auth_crud_cat.rar (44 MB)
https://drive.google.com/file/d/1HfQU7JOY8FOrusjwobnKvChI5wfGshPO/view?usp=sharing