private function getTable($board_key) { $board = Board::where('key', $board_key)->first(); if (!$board) { return null; } return 'sboard_' . $board->key . '_comments'; }
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'); }); }
public function fire() { $board_key = $this->argument('board_key'); Board::where(['key' => $board_key])->delete(); }
public function get_board_list() { $boards = Board::orderBy('id', 'desc')->paginate(10); return view('ncells::sboard.pages.board_list', ['boards' => $boards]); }