라라벨에서 컨트롤,모델,테이블을 생성하는방법
php artisan make:model Weaving -c -m
모델
C:\laravel\myLaravel8\myapp\app\Weaving.php
컨트럴러
C:\laravel\myLaravel8\myapp\app\Http\WeavingController.php
데이터베이스의 테이블
database>migrations
2019_10_12_080203_create_weavings_table.php 파일이 생성된다.
1) 가장 최근의 마이그레이션 작업(operation)을 되돌리려면 rollback 명령어. 가장 최근에 실행된 마이그레이션의 "모음(batch)", 즉 여러개의 마이그레이션 파일에 대해서 되돌릴 수 있습니다:
PS C:\xampp\htdocs\myStock> php artisan migrate:rollback
2) 데이타베이스에 있는 내용을 모두 삭제하고 다시 실행
PS C:\xampp\htdocs\myStock> php artisan migrate:fresh
3) 테이블의 컬럼 추가
php artisan make:migration add_title_to_tasks_table --table="tasks"
Edit the newly created file in the migrations folder and add the below.
Run the migrations command.
php artisan migrate
4) 테이블 삭제
php artisan make:migration drop_user_table
테이블 변경시. php artisan migrate실행을 통해서 변경된 테이블을 적용 할 수 있다.
besma@LAPTOP-K52ARI3B MINGW64 /c/laravel/myProject (master)
$ php artisan migrate
Migration table created successfully.