/** * Reverse the migrations. * * @return void */ public function down() { Schema::drop(Models::table('participants')); }
/** * {@inheritDoc} */ public function __construct(array $attributes = []) { $this->table = Models::table('messages'); parent::__construct($attributes); }
/** * Reverse the migrations. * * @return void */ public function down() { Schema::drop(Models::table('messages')); }
/** * Run the migrations. * * @return void */ public function up() { DB::statement('ALTER TABLE `' . DB::getTablePrefix() . Models::table('participants') . '` CHANGE COLUMN `last_read` `last_read` timestamp NULL ON UPDATE CURRENT_TIMESTAMP DEFAULT CURRENT_TIMESTAMP;'); }
/** * Reverse the migrations. * * @return void */ public function down() { Schema::drop(Models::table('threads')); }
/** * Run the migrations. * * @return void */ public function up() { DB::statement('ALTER TABLE `' . DB::getTablePrefix() . Models::table('participants') . '` CHANGE COLUMN `last_read` `last_read` timestamp NULL DEFAULT NULL;'); }
/** * Reverse the migrations. * * @return void */ public function down() { Schema::table(Models::table('threads'), function (Blueprint $table) { $table->dropSoftDeletes(); }); }
/** * Generates a select string used in participantsString(). * * @param $columns * * @return string */ protected function createSelectString($columns) { $dbDriver = $this->getConnection()->getDriverName(); $tablePrefix = $this->getConnection()->getTablePrefix(); $usersTable = Models::table('users'); switch ($dbDriver) { case 'pgsql': case 'sqlite': $columnString = implode(" || ' ' || " . $tablePrefix . $usersTable . '.', $columns); $selectString = '(' . $tablePrefix . $usersTable . '.' . $columnString . ') as name'; break; case 'sqlsrv': $columnString = implode(" + ' ' + " . $tablePrefix . $usersTable . '.', $columns); $selectString = '(' . $tablePrefix . $usersTable . '.' . $columnString . ') as name'; break; default: $columnString = implode(", ' ', " . $tablePrefix . $usersTable . '.', $columns); $selectString = 'concat(' . $tablePrefix . $usersTable . '.' . $columnString . ') as name'; } return $selectString; }