updating wn:resources to follow changes on wn:resource

This commit is contained in:
Amine Ben hammou 2017-01-18 18:21:40 +00:00
parent 482cc3f8c4
commit cfe5b2f69b
4 changed files with 28 additions and 26 deletions

View File

@ -5,7 +5,7 @@ APP_KEY=SomeRandomKey!!!
# APP_LOCALE=en
# APP_FALLBACK_LOCALE=en
# DB_CONNECTION=mysql
DB_CONNECTION=sqlite
# DB_HOST=localhost
# DB_PORT=3306
# DB_DATABASE=homestead

View File

@ -1,6 +1,7 @@
---
Post:
belongsToMany: tags
add: timestamps softDeletes
fields:
title:
schema: string

View File

View File

@ -26,6 +26,7 @@ class ResourcesCommand extends BaseCommand {
$this->call('wn:resource', [
'name' => $i['name'],
'fields' => $i['fields'],
'--add' => $i['add'],
'--has-many' => $i['hasMany'],
'--has-one' => $i['hasOne'],
'--belongs-to' => $i['belongsTo'],
@ -35,7 +36,7 @@ class ResourcesCommand extends BaseCommand {
]);
}
// $this->call('migrate');
$this->call('migrate');
$this->pivotTables = array_map(
'unserialize',
@ -56,14 +57,14 @@ class ResourcesCommand extends BaseCommand {
// ]);
}
// $this->call('migrate');
$this->call('migrate');
}
protected function getResourceParams($modelName, $i)
{
$i['name'] = snake_case($modelName);
foreach(['hasMany', 'hasOne', 'belongsTo', 'belongsToMany'] as $relation){
foreach(['hasMany', 'hasOne', 'add', 'belongsTo', 'belongsToMany'] as $relation){
if(isset($i[$relation])){
$i[$relation] = $this->convertArray($i[$relation], ' ', ',');
} else {