Apply fixes from StyleCI

This commit is contained in:
Nabeel Shahzad
2018-08-26 16:40:04 +00:00
committed by StyleCI Bot
parent 20f46adbc4
commit 9596d88b48
407 changed files with 4032 additions and 3286 deletions

View File

@@ -1,16 +1,12 @@
<?php
/**
*
*/
namespace App\Support;
use Carbon\Carbon;
use Illuminate\Database\QueryException;
use Illuminate\Support\Facades\DB;
use Symfony\Component\Yaml\Yaml;
use Webpatser\Uuid\Uuid;
use Log;
use Symfony\Component\Yaml\Yaml;
class Database
{
@@ -25,8 +21,10 @@ class Database
/**
* @param $yaml_file
* @param bool $ignore_errors
* @return array
*
* @throws \Exception
*
* @return array
*/
public static function seed_from_yaml_file($yaml_file, $ignore_errors = false): array
{
@@ -37,8 +35,10 @@ class Database
/**
* @param $yml
* @param bool $ignore_errors
* @return array
*
* @throws \Exception
*
* @return array
*/
public static function seed_from_yaml($yml, $ignore_errors = false): array
{
@@ -58,7 +58,7 @@ class Database
throw $e;
}
++$imported[$table];
$imported[$table]++;
}
}
@@ -66,19 +66,21 @@ class Database
}
/**
* @param $table
* @param $row
* @return mixed
* @param $table
* @param $row
*
* @throws \Exception
*
* @return mixed
*/
public static function insert_row($table, $row)
{
# encrypt any password fields
// encrypt any password fields
if (array_key_exists('password', $row)) {
$row['password'] = bcrypt($row['password']);
}
# if any time fields are == to "now", then insert the right time
// if any time fields are == to "now", then insert the right time
foreach ($row as $column => $value) {
if (strtolower($value) === 'now') {
$row[$column] = static::time();
@@ -89,6 +91,7 @@ class Database
DB::table($table)->insert($row);
} catch (QueryException $e) {
Log::error($e);
throw $e;
}