laravel-enso에도 Comments가 있네요

· 7년 전 · 1257

라라벨의 package를 사용해서 만든 것 같습니다.

 

https://github.com/laravel-enso/CommentsManager

 

vendor로 등록되는 구조이니..  라라벨에서 메인 코어는 나눠도 각각 패키지별로 업그레이드가 편하게 

 

할 수 있을 것 같습니다.

 

morphs를 잘 이해해야 되네요

 

CommentsTable

 

public function up()

{

  Schema::create('comments', function (Blueprint $table) {

    $table->increments('id');

 

    $table->morphs('commentable');

 

    $table->text('body');

 

    $table->integer('created_by')->unsigned()->nullable();

    $table->foreign('created_by')->references('id')->on('users');

 

    $table->integer('updated_by')->unsigned()->nullable();

    $table->foreign('updated_by')->references('id')->on('users');

 

    $table->timestamps();

  });

}

 

CommentUserPivotTable

public function up()

{

    Schema::create('comment_user', function (Blueprint $table) {

        $table->integer('comment_id')->unsigned()->index();

        $table->foreign('comment_id')->references('id')->on('comments')

            ->onDelete('cascade');

 

        $table->integer('user_id')->unsigned()->index();

        $table->foreign('user_id')->references('id')->on('users')

            ->onDelete('cascade');

 

        $table->primary(['comment_id', 'user_id']);

    });

}

 

|
댓글을 작성하시려면 로그인이 필요합니다. 로그인

PHP프레임워크

+
분류 제목 글쓴이 날짜 조회
기타 6년 전 조회 1,820
기타 6년 전 조회 2,589
라라벨 6년 전 조회 2,034
기타 6년 전 조회 2,041
라라벨 6년 전 조회 2,446
라라벨 6년 전 조회 1,688
라라벨 7년 전 조회 2,120
라라벨 7년 전 조회 3,163
라라벨 7년 전 조회 1,656
기타 7년 전 조회 1,429
라라벨 7년 전 조회 2,085
라라벨 7년 전 조회 3,045
라라벨 7년 전 조회 2,102
라라벨 7년 전 조회 2,075
라라벨 7년 전 조회 1,258
라라벨 7년 전 조회 2,012
라라벨 7년 전 조회 2,002
라라벨 7년 전 조회 5,410
코드이그나이터 7년 전 조회 6,712
라라벨 7년 전 조회 1,293
라라벨 7년 전 조회 1,257
라라벨 7년 전 조회 1,194
라라벨 7년 전 조회 1,237
라라벨 7년 전 조회 1,632
라라벨 7년 전 조회 1,103
라라벨 7년 전 조회 1,266
라라벨 7년 전 조회 1,449
기타 7년 전 조회 1,137
라라벨 7년 전 조회 1,536
라라벨 7년 전 조회 1,114
🐛 버그신고