snipe-it/database/seeds/CustomFieldSeeder.php

28 lines
664 B
PHP
Raw Normal View History

2016-03-25 01:18:05 -07:00
<?php
use Illuminate\Database\Seeder;
use App\Models\CustomField;
use Illuminate\Support\Facades\Schema;
use Illuminate\Database\Schema\Blueprint;
2016-03-25 01:18:05 -07:00
class CustomFieldSeeder extends Seeder
{
public function run()
{
$columns = DB::getSchemaBuilder()->getColumnListing('assets');
foreach ($columns as $column) {
if(strpos($column, '_snipeit_') !== FALSE) {
Schema::table('assets', function (Blueprint $table) use ($column) {
$table->dropColumn($column);
});
}
}
2016-03-25 01:18:05 -07:00
CustomField::truncate();
factory(CustomField::class, 4)->create();
2016-03-25 01:18:05 -07:00
}
}