고요빛물결

[lavuebd]라라벨에 ERD 기준으로 model을 만들어 보죠

· 2019-01-08 (화) 03:14:58 · 1609

member는 laravel에 있는 user를 그냥 사용합니다.

php artisan make:model group -m

php artisan make:model board -m

php artisan make:model post -m

php artisan make:model comment -m

 

app/group.php app/board.php app/post.php 와

database/migrations/날짜_create_groups_table.php, create_boards_table.php, create_posts_table.php, create_comments_table.php

 

가 만들어진것을 확인 할수 있습니다.

 

왼쪽에서 creat_users_table.php를 클릭해서 (vscode 기준입니다.)

 

$table->string('name'); 을 alt+shift+down arrow로 라인을 카피한후에

name을 nickname으로 변경합니다.  각 테이블에 대한 Field는 여기 참조 

 

$table->increments('id');

$table->string('name');

$table->string('nickname');

$table->string('email')->unique();

$table->timestamp('email_verified_at')->nullable();

$table->string('password');

$table->rememberToken();

$table->timestamps();

 

groups

$table->increments('id');

$table->string('name');

$table->tinyinteger('order')

$table->timestamps();

 

boards

$table->increments('id');

$table->integer('group_id')->unsigned();

$table->string('name');

$table->string('mobile_name');

$table->tinyinteger('order');

$table->timestamps();

 

posts

$table->increments('id');

$table->integer('member_id')->unsigned();

$table->integer('board_id')->unsigned();

$table->string('title');

$table->mediumtext('content');

$table->string('username');

$table->string('nickname');

$table->timestamps();

 

comments

$table->increments('id');

$table->integer('member_id')->unsigned();

$table->integer('board_id')->unsigned();

$table->integer('post_id')->unsigned();

$table->mediumtext('content');

$table->string('username');

$table->string('nickname');

$table->timestamps();

 

 

 

 

 

댓글을 작성하시려면 로그인이 필요합니다.
+
분류 제목 글쓴이 날짜 조회
코드이그나이터 16-12-18 조회 1,370
코드이그나이터
[코드이그나이터]
16-12-16 조회 1,257
코드이그나이터
[코드이그나이터]
16-12-15 조회 1,712
코드이그나이터
[코드이그나이터]
16-12-15 조회 1,390
코드이그나이터
[코드이그나이터]
16-12-14 조회 1,380
코드이그나이터 16-12-14 조회 1,362
코드이그나이터 16-12-14 조회 1,308
라라벨 22-01-18 조회 4,564
라라벨 21-07-06 조회 1,896
기타 21-03-16 조회 2,168
기타 21-01-17 조회 2,593
기타 21-01-10 조회 2,142
라라벨 21-01-02 조회 2,638
라라벨 20-12-12 조회 2,195
라라벨
[라라벨]
20-09-13 조회 3,157
기타 20-08-22 조회 2,344
라라벨 20-06-18 조회 2,989
라라벨 20-06-13 조회 2,451
라라벨 20-04-29 조회 2,330
라라벨 20-04-29 조회 2,686
라라벨 20-03-25 조회 2,090
기타 20-03-15 조회 2,446
라라벨
[라라벨]
20-03-15 조회 2,462
라라벨 20-02-27 조회 1,965
라라벨 20-02-27 조회 2,090
라라벨 20-02-26 조회 2,027
기타 19-12-23 조회 2,773
라라벨 19-09-11 조회 2,617
기타 19-09-08 조회 2,567
기타 19-03-12 조회 2,493