Cleanup for settings table and moved some seed data into the migrations

This commit is contained in:
Nabeel Shahzad
2017-12-09 21:21:49 -06:00
parent b165cd28b6
commit d34e30666d
19 changed files with 323 additions and 204 deletions

View File

@@ -0,0 +1,31 @@
<?php
/**
* Migration base class with some extra functionality
*/
namespace App\Models\Migrations;
use DB;
use Illuminate\Database\Migrations\Migration as MigrationBase;
class Migration extends MigrationBase
{
/**
* Add rows to a table
* @param $table
* @param $rows
*/
public function addData($table, $rows)
{
foreach ($rows as $row) {
try {
DB::table($table)->insert($row);
} catch (Exception $e) {
# setting already exists
if ($e->getCode() === 23000) {
continue;
}
}
}
}
}