Skip to content

Commit

Permalink
Merge pull request #2087 from LuckyCyborg/4.0
Browse files Browse the repository at this point in the history
Improve the Database Seeding
  • Loading branch information
LuckyCyborg authored Jun 5, 2018
2 parents 9b350de + bcf7546 commit 82556ec
Show file tree
Hide file tree
Showing 4 changed files with 29 additions and 3 deletions.
2 changes: 2 additions & 0 deletions app/Database/Seeds/DatabaseSeeder.php
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
<?php

namespace App\Database\Seeds;

use Nova\Database\ORM\Model;
use Nova\Database\Seeder;

Expand Down
2 changes: 1 addition & 1 deletion app/Platform/Bootstrap.php
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
// Define The Application Version
//--------------------------------------------------------------------------

define('VERSION', '4.0.69');
define('VERSION', '4.0.70');

//--------------------------------------------------------------------------
// Set PHP Error Reporting Options
Expand Down
3 changes: 1 addition & 2 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -47,8 +47,7 @@
},
"autoload": {
"classmap": [
"app/Database/Migrations",
"app/Database/Seeds"
"app/Database/Migrations"
],
"psr-4": {
"App\\": "app/",
Expand Down
25 changes: 25 additions & 0 deletions shared/Support/helpers.php
Original file line number Diff line number Diff line change
Expand Up @@ -83,3 +83,28 @@ function human_size($bytes, $decimals = 2)
return sprintf("%.{$decimals}f", $bytes / pow(1024, $factor)) . @$size[$factor];
}
}

if (! function_exists('sanitize'))
{
function sanitize($data, $filter)
{
switch ($filter) {
case 'string':
return filter_var($data, FILTER_SANITIZE_STRING);

case 'email':
return filter_var($data, FILTER_SANITIZE_EMAIL);

case 'integer':
return filter_var($data, FILTER_SANITIZE_NUMBER_INT);

case 'float':
return filter_var($data, FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION | FILTER_FLAG_ALLOW_THOUSAND);

case 'url':
return filter_var($data, FILTER_SANITIZE_URL);
}

throw new InvalidArgumentException('Filter sanitize unknown.');
}
}

0 comments on commit 82556ec

Please sign in to comment.