diff --git a/lumen-test/app/Http/Controllers/Controller.php b/lumen-test/app/Http/Controllers/Controller.php index 0ccb918..9146f93 100644 --- a/lumen-test/app/Http/Controllers/Controller.php +++ b/lumen-test/app/Http/Controllers/Controller.php @@ -8,3 +8,4 @@ class Controller extends BaseController { // } + diff --git a/lumen-test/clean.sh b/lumen-test/clean.sh new file mode 100755 index 0000000..569b693 --- /dev/null +++ b/lumen-test/clean.sh @@ -0,0 +1,43 @@ +# models +rm app/*.php 2> /dev/null + +# migrations +rm database/migrations/*.php 2> /dev/null + +# routes +echo "get(\"/\", function () use (\$app) { + return \$app->welcome(); +});" > app/Http/routes.php + +# Controllers +rm app/Http/Controllers/*.php 2> /dev/null +echo " app/Http/Controllers/Controller.php + +# factories +echo "define(App\User::class, function (\$faker) { + return [ + 'name' => \$faker->name, + 'email' => \$faker->email, + 'password' => str_random(10), + 'remember_token' => str_random(10), + ]; +}); +" > database/factories/ModelFactory.php + +# database +rm database/database.sqlite 2> /dev/null +touch database/database.sqlite diff --git a/lumen-test/models.yml b/lumen-test/models.yml deleted file mode 100644 index ac7161c..0000000 --- a/lumen-test/models.yml +++ /dev/null @@ -1,23 +0,0 @@ ---- -Post: - belongsToMany: tags - add: timestamps softDeletes - fields: - title: - schema: string - rules: required - tags: fillable - content: - schema: text nullable - tags: fillable - published_at: - schema: date - rules: date - tags: date fillable -Tag: - belongsToMany: posts - fields: - name: - schema: string unique - rules: required - tags: fillable diff --git a/src/Commands/ResourcesCommand.php b/src/Commands/ResourcesCommand.php index 477dc72..822dde6 100644 --- a/src/Commands/ResourcesCommand.php +++ b/src/Commands/ResourcesCommand.php @@ -36,7 +36,7 @@ class ResourcesCommand extends BaseCommand { ]); } - $this->call('migrate'); + // $this->call('migrate'); // actually needed for pivot seeders ! $this->pivotTables = array_map( 'unserialize', @@ -72,25 +72,6 @@ class ResourcesCommand extends BaseCommand { } } - if($i['belongsTo']){ - $relations = $this->getArgumentParser('relations')->parse($i['belongsTo']); - foreach ($relations as $relation){ - $foreignName = ''; - - if(! $relation['model']){ - $foreignName = snake_case($relation['name']) . '_id'; - } else { - $names = array_reverse(explode("\\", $relation['model'])); - $foreignName = snake_case($names[0]) . '_id'; - } - - $i['fields'][$foreignName] = [ - 'schema' => 'integer', - 'tags' => 'key' - ]; - } - } - if($i['belongsToMany']){ $relations = $this->getArgumentParser('relations')->parse($i['belongsToMany']); foreach ($relations as $relation){