mirror of
https://github.com/ZorgCC/lumen-generators.git
synced 2025-01-27 20:37:55 +03:00
updating wn:resources to follow changes on wn:resource
This commit is contained in:
parent
482cc3f8c4
commit
cfe5b2f69b
@ -5,7 +5,7 @@ APP_KEY=SomeRandomKey!!!
|
|||||||
# APP_LOCALE=en
|
# APP_LOCALE=en
|
||||||
# APP_FALLBACK_LOCALE=en
|
# APP_FALLBACK_LOCALE=en
|
||||||
|
|
||||||
# DB_CONNECTION=mysql
|
DB_CONNECTION=sqlite
|
||||||
# DB_HOST=localhost
|
# DB_HOST=localhost
|
||||||
# DB_PORT=3306
|
# DB_PORT=3306
|
||||||
# DB_DATABASE=homestead
|
# DB_DATABASE=homestead
|
||||||
|
@ -1,22 +1,23 @@
|
|||||||
---
|
---
|
||||||
Post:
|
Post:
|
||||||
belongsToMany: tags
|
belongsToMany: tags
|
||||||
fields:
|
add: timestamps softDeletes
|
||||||
title:
|
fields:
|
||||||
schema: string
|
title:
|
||||||
rules: required
|
schema: string
|
||||||
tags: fillable
|
rules: required
|
||||||
content:
|
tags: fillable
|
||||||
schema: text nullable
|
content:
|
||||||
tags: fillable
|
schema: text nullable
|
||||||
published_at:
|
tags: fillable
|
||||||
schema: date
|
published_at:
|
||||||
rules: date
|
schema: date
|
||||||
tags: date fillable
|
rules: date
|
||||||
Tag:
|
tags: date fillable
|
||||||
belongsToMany: posts
|
Tag:
|
||||||
fields:
|
belongsToMany: posts
|
||||||
name:
|
fields:
|
||||||
schema: string unique
|
name:
|
||||||
rules: required
|
schema: string unique
|
||||||
tags: fillable
|
rules: required
|
||||||
|
tags: fillable
|
||||||
|
0
lumen-test/storage/database.sqlite
Normal file
0
lumen-test/storage/database.sqlite
Normal file
@ -26,6 +26,7 @@ class ResourcesCommand extends BaseCommand {
|
|||||||
$this->call('wn:resource', [
|
$this->call('wn:resource', [
|
||||||
'name' => $i['name'],
|
'name' => $i['name'],
|
||||||
'fields' => $i['fields'],
|
'fields' => $i['fields'],
|
||||||
|
'--add' => $i['add'],
|
||||||
'--has-many' => $i['hasMany'],
|
'--has-many' => $i['hasMany'],
|
||||||
'--has-one' => $i['hasOne'],
|
'--has-one' => $i['hasOne'],
|
||||||
'--belongs-to' => $i['belongsTo'],
|
'--belongs-to' => $i['belongsTo'],
|
||||||
@ -35,7 +36,7 @@ class ResourcesCommand extends BaseCommand {
|
|||||||
]);
|
]);
|
||||||
}
|
}
|
||||||
|
|
||||||
// $this->call('migrate');
|
$this->call('migrate');
|
||||||
|
|
||||||
$this->pivotTables = array_map(
|
$this->pivotTables = array_map(
|
||||||
'unserialize',
|
'unserialize',
|
||||||
@ -56,14 +57,14 @@ class ResourcesCommand extends BaseCommand {
|
|||||||
// ]);
|
// ]);
|
||||||
}
|
}
|
||||||
|
|
||||||
// $this->call('migrate');
|
$this->call('migrate');
|
||||||
}
|
}
|
||||||
|
|
||||||
protected function getResourceParams($modelName, $i)
|
protected function getResourceParams($modelName, $i)
|
||||||
{
|
{
|
||||||
$i['name'] = snake_case($modelName);
|
$i['name'] = snake_case($modelName);
|
||||||
|
|
||||||
foreach(['hasMany', 'hasOne', 'belongsTo', 'belongsToMany'] as $relation){
|
foreach(['hasMany', 'hasOne', 'add', 'belongsTo', 'belongsToMany'] as $relation){
|
||||||
if(isset($i[$relation])){
|
if(isset($i[$relation])){
|
||||||
$i[$relation] = $this->convertArray($i[$relation], ' ', ',');
|
$i[$relation] = $this->convertArray($i[$relation], ' ', ',');
|
||||||
} else {
|
} else {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user