コード例 #1
0
 private function getTable($board_key)
 {
     $board = Board::where('key', $board_key)->first();
     if (!$board) {
         return null;
     }
     return 'sboard_' . $board->key . '_comments';
 }
コード例 #2
0
 public function fire()
 {
     $board_key = $this->argument('board_key');
     Board::create(['key' => $board_key]);
     Schema::create('sboard_' . $board_key, function (Blueprint $table) {
         $table->increments('id');
         $table->string('title');
         $table->longText('content');
         $table->integer('writer_id')->index();
         $table->timestamps();
         $table->softDeletes();
     });
     Schema::create('sboard_' . $board_key . '_comments', function (Blueprint $table) {
         $table->increments('id');
         $table->unsignedInteger('post_id');
         $table->longText('content');
         $table->integer('writer_id')->index();
         $table->timestamps();
         $table->softDeletes();
         $table->index('post_id');
     });
 }
コード例 #3
0
 public function fire()
 {
     $board_key = $this->argument('board_key');
     Board::where(['key' => $board_key])->delete();
 }
コード例 #4
0
 public function get_board_list()
 {
     $boards = Board::orderBy('id', 'desc')->paginate(10);
     return view('ncells::sboard.pages.board_list', ['boards' => $boards]);
 }