Apply fixes from StyleCI
This commit is contained in:
committed by
StyleCI Bot
parent
20f46adbc4
commit
9596d88b48
@@ -7,7 +7,6 @@ use DB;
|
||||
|
||||
/**
|
||||
* Class Migration
|
||||
* @package App\Interfaces
|
||||
*/
|
||||
abstract class Migration extends \Illuminate\Database\Migrations\Migration
|
||||
{
|
||||
@@ -16,6 +15,7 @@ abstract class Migration extends \Illuminate\Database\Migrations\Migration
|
||||
|
||||
/**
|
||||
* At a minimum, this function needs to be implemented
|
||||
*
|
||||
* @return mixed
|
||||
*/
|
||||
abstract public function up();
|
||||
@@ -25,13 +25,13 @@ abstract class Migration extends \Illuminate\Database\Migrations\Migration
|
||||
*/
|
||||
public function down()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Dynamically figure out the offset and the start number for a group.
|
||||
* This way we don't need to mess with how to order things
|
||||
* When calling getNextOrderNumber(users) 31, will be returned, then 32, and so on
|
||||
*
|
||||
* @param $name
|
||||
* @param null $offset
|
||||
* @param int $start_offset
|
||||
@@ -53,12 +53,12 @@ abstract class Migration extends \Illuminate\Database\Migrations\Migration
|
||||
$start_offset = $offset + 1;
|
||||
}
|
||||
} else {
|
||||
# Now find the number to start from
|
||||
// Now find the number to start from
|
||||
$start_offset = (int) DB::table('settings')->where('group', $name)->max('order');
|
||||
if ($start_offset === null) {
|
||||
$start_offset = $offset + 1;
|
||||
} else {
|
||||
++$start_offset;
|
||||
$start_offset++;
|
||||
}
|
||||
|
||||
$offset = $group->offset;
|
||||
@@ -71,7 +71,9 @@ abstract class Migration extends \Illuminate\Database\Migrations\Migration
|
||||
|
||||
/**
|
||||
* Get the next increment number from a group
|
||||
*
|
||||
* @param $group
|
||||
*
|
||||
* @return int
|
||||
*/
|
||||
public function getNextOrderNumber($group): int
|
||||
@@ -81,7 +83,7 @@ abstract class Migration extends \Illuminate\Database\Migrations\Migration
|
||||
}
|
||||
|
||||
$idx = $this->counters[$group];
|
||||
++$this->counters[$group];
|
||||
$this->counters[$group]++;
|
||||
|
||||
return $idx;
|
||||
}
|
||||
@@ -114,6 +116,7 @@ abstract class Migration extends \Illuminate\Database\Migrations\Migration
|
||||
|
||||
/**
|
||||
* Update a setting
|
||||
*
|
||||
* @param $key
|
||||
* @param $value
|
||||
* @param array $attrs
|
||||
@@ -128,6 +131,7 @@ abstract class Migration extends \Illuminate\Database\Migrations\Migration
|
||||
|
||||
/**
|
||||
* Add rows to a table
|
||||
*
|
||||
* @param $table
|
||||
* @param $rows
|
||||
*/
|
||||
@@ -137,7 +141,7 @@ abstract class Migration extends \Illuminate\Database\Migrations\Migration
|
||||
try {
|
||||
DB::table($table)->insert($row);
|
||||
} catch (\Exception $e) {
|
||||
# setting already exists, just ignore it
|
||||
// setting already exists, just ignore it
|
||||
if ($e->getCode() === 23000) {
|
||||
continue;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user