고요빛물결

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

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

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();

 

 

 

 

 

댓글을 작성하시려면 로그인이 필요합니다.
+
분류 제목 글쓴이 날짜 조회
기타 17-04-09 조회 3,377
라라벨 17-04-08 조회 2,964
라라벨 17-04-07 조회 2,538
라라벨 17-04-07 조회 2,560
라라벨 17-04-06 조회 4,219
라라벨 17-04-06 조회 3,670
라라벨 17-04-06 조회 2,532
라라벨 17-04-05 조회 1,928
라라벨 17-04-05 조회 1,968
라라벨 17-04-03 조회 1,733
라라벨 17-04-03 조회 1,766
라라벨 17-04-02 조회 1,842
라라벨 17-04-02 조회 2,020
라라벨
[라라벨]
17-04-01 조회 1,828
라라벨 17-03-31 조회 1,683
라라벨 17-03-31 조회 2,617
라라벨 17-03-31 조회 1,996
라라벨 17-03-30 조회 2,368
라라벨 17-03-29 조회 2,005
라라벨 17-03-28 조회 2,288
라라벨 17-03-27 조회 2,105
라라벨 17-03-26 조회 1,832
라라벨 17-03-25 조회 1,820
라라벨 17-03-24 조회 1,974
라라벨 17-03-23 조회 3,990
일반 17-03-15 조회 1,870
라라벨 17-03-07 조회 4,278
라라벨 17-03-06 조회 1.4만
일반
[일반]
17-02-24 조회 2,031
일반 17-02-23 조회 1,975