Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
M
meibuyu-micro
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
1
Merge Requests
1
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
without authentication
meibuyu-micro
Commits
38da851f
Commit
38da851f
authored
May 09, 2020
by
王源
🎧
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
修改生成模型类方法
parent
0be2078e
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
7 additions
and
5 deletions
+7
-5
MakeModelCommand.php
src/Command/MakeModelCommand.php
+7
-5
No files found.
src/Command/MakeModelCommand.php
View file @
38da851f
...
...
@@ -356,18 +356,20 @@ class MakeModelCommand extends HyperfCommand
}
$fillAble
.=
"
\t\t
'"
.
$name
.
"',"
.
"
\n
"
;
if
(
isset
(
$this
->
cc
[
$v
[
'data_type'
]])
&&
$this
->
cc
[
$v
[
'data_type'
]]
!=
'string'
)
{
if
(
$this
->
cc
[
$v
[
'data_type'
]]
==
'timestamp'
)
{
$casts
.=
"
\t\t
'"
.
$name
.
"'=>'datetime',
\n
"
;
}
else
{
$casts
.=
"
\t\t
'"
.
$name
.
"'=>'"
.
$this
->
cc
[
$v
[
'data_type'
]]
.
"',
\n
"
;
}
}
}
$relation
=
''
;
if
(
isset
(
$info
[
'relations'
])
&&
$info
[
'relations'
])
{
$relation
.=
"
\n
"
;
if
(
isset
(
$info
[
'relations'
][
'belongsTo'
]))
{
foreach
(
$info
[
'relations'
][
'belongsTo'
]
as
$v
)
{
$relation
.=
"
\n\t
/**
\n\t
* 属于"
.
$v
[
'relation_model_name'
]
.
"的关联"
;
$relation
.=
"
\n\t
* @return "
.
$v
[
'relation_model_name'
];
$relation
.=
"
\n\t
**/"
;
$relation
.=
"
\n\t
public function "
.
$v
[
'function'
]
.
"() : "
.
$v
[
'relation_model_name'
];
$relation
.=
"
\n\t
/**
\n\t
* 属于"
.
$v
[
'relation_model_name'
]
.
"的关联
\n\t
*/"
;
$relation
.=
"
\n\t
public function "
.
$v
[
'function'
]
.
"()"
;
$relation
.=
"
\n\t
{"
;
$relation
.=
"
\n\t\t
"
.
'return $this->belongsTo('
.
$v
[
'relation_model_name'
]
.
"::class,'"
.
$v
[
'local_table_key'
]
.
"','
{
$v
[
'relation_table_key'
]
}
' );"
;
$relation
.=
"
\n\t
}"
;
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment