check for field type/values in seeder

This commit is contained in:
Nabeel Shahzad 2017-06-13 14:00:34 -05:00
parent e7d93d8435
commit 8c87c697ac

View File

@ -29,13 +29,13 @@ class DevelopmentSeeder extends Seeder
foreach ($rows as $row) {
# encrypt any password fields
if(in_array('password', $row, true)) {
if(array_key_exists('password', $row)) {
$row['password'] = bcrypt($row['password']);
}
# if any time fields are == to "now", then insert the right time
foreach($time_fields as $tf) {
if(in_array($tf, $row, true) && $row[$tf] === 'now') {
if(array_key_exists($tf, $row) && $row[$tf] === 'now') {
$row[$tf] = $this->time();
}
}