Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
M
meibuyu-rpc
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
0
Merge Requests
0
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-rpc
Commits
3db122d9
Commit
3db122d9
authored
May 08, 2020
by
梁俊杰
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
关联关系方法使用蛇形形式编写
parent
47512cd0
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
3 additions
and
4 deletions
+3
-4
MakeModelCommand.php
src/Command/MakeModelCommand.php
+3
-4
No files found.
src/Command/MakeModelCommand.php
View file @
3db122d9
...
@@ -192,7 +192,7 @@ class MakeModelCommand extends HyperfCommand
...
@@ -192,7 +192,7 @@ class MakeModelCommand extends HyperfCommand
$relation
[
'local_table_key'
]
=
$fv
[
'column_name'
];
$relation
[
'local_table_key'
]
=
$fv
[
'column_name'
];
}
}
$relation
[
'relation_table'
]
=
$fv
[
'table_name'
];
$relation
[
'relation_table'
]
=
$fv
[
'table_name'
];
$relation
[
'function'
]
=
Str
::
camel
(
$relation
[
'constraint_table'
]);
$relation
[
'function'
]
=
Str
::
snake
(
$relation
[
'constraint_table'
]);
$relation
[
'relation_model_name'
]
=
Str
::
studly
(
Str
::
singular
(
$relation
[
'constraint_table'
]));
$relation
[
'relation_model_name'
]
=
Str
::
studly
(
Str
::
singular
(
$relation
[
'constraint_table'
]));
$tables
[
$relation
[
'local_table'
]][
'relations'
][
'belongsToMany'
][]
=
$relation
;
$tables
[
$relation
[
'local_table'
]][
'relations'
][
'belongsToMany'
][]
=
$relation
;
}
else
{
}
else
{
...
@@ -201,7 +201,7 @@ class MakeModelCommand extends HyperfCommand
...
@@ -201,7 +201,7 @@ class MakeModelCommand extends HyperfCommand
if
(
!
isset
(
$tables
[
$relation
[
'relation_table'
]]))
{
if
(
!
isset
(
$tables
[
$relation
[
'relation_table'
]]))
{
continue
;
continue
;
}
}
$relation
[
'function'
]
=
Str
::
camel
(
Str
::
singular
(
$relation
[
'relation_table'
]));
$relation
[
'function'
]
=
Str
::
snake
(
Str
::
singular
(
$relation
[
'relation_table'
]));
$relation
[
'relation_model_name'
]
=
Str
::
studly
(
Str
::
singular
(
$relation
[
'relation_table'
]));
$relation
[
'relation_model_name'
]
=
Str
::
studly
(
Str
::
singular
(
$relation
[
'relation_table'
]));
$relation
[
'relation_table_key'
]
=
"id"
;
$relation
[
'relation_table_key'
]
=
"id"
;
$relation
[
'local_table'
]
=
$fv
[
'table_name'
];
$relation
[
'local_table'
]
=
$fv
[
'table_name'
];
...
@@ -212,7 +212,7 @@ class MakeModelCommand extends HyperfCommand
...
@@ -212,7 +212,7 @@ class MakeModelCommand extends HyperfCommand
$reverseRelation
[
'relation_table_key'
]
=
$relation
[
'local_table_key'
];
$reverseRelation
[
'relation_table_key'
]
=
$relation
[
'local_table_key'
];
$reverseRelation
[
'local_table'
]
=
$relation
[
'relation_table'
];
$reverseRelation
[
'local_table'
]
=
$relation
[
'relation_table'
];
$reverseRelation
[
'local_table_key'
]
=
$relation
[
'relation_table_key'
];
$reverseRelation
[
'local_table_key'
]
=
$relation
[
'relation_table_key'
];
$reverseRelation
[
'function'
]
=
Str
::
camel
(
$reverseRelation
[
'relation_table'
]);
$reverseRelation
[
'function'
]
=
Str
::
snake
(
$reverseRelation
[
'relation_table'
]);
$reverseRelation
[
'relation_model_name'
]
=
Str
::
studly
(
Str
::
singular
(
$reverseRelation
[
'relation_table'
]));
$reverseRelation
[
'relation_model_name'
]
=
Str
::
studly
(
Str
::
singular
(
$reverseRelation
[
'relation_table'
]));
$tables
[
$reverseRelation
[
'local_table'
]][
'relations'
][
'hasMany'
][]
=
$reverseRelation
;
$tables
[
$reverseRelation
[
'local_table'
]][
'relations'
][
'hasMany'
][]
=
$reverseRelation
;
}
}
...
@@ -786,7 +786,6 @@ class MakeModelCommand extends HyperfCommand
...
@@ -786,7 +786,6 @@ class MakeModelCommand extends HyperfCommand
$content
.=
"
\n\t\t
Router::delete('/
{
id
}
', 'App\Controller
\\
"
.
$modelClass
.
"Controller@delete');"
;
$content
.=
"
\n\t\t
Router::delete('/
{
id
}
', 'App\Controller
\\
"
.
$modelClass
.
"Controller@delete');"
;
if
(
$routes
)
{
if
(
$routes
)
{
foreach
(
$routes
as
$v
)
{
foreach
(
$routes
as
$v
)
{
$r
=
Str
::
snake
(
$v
);
$content
.=
"
\n\t\t
Router::get('/
$r
/\{id\}', 'App\Controller
\\
"
.
$modelClass
.
"Controller@
$v
');"
;
$content
.=
"
\n\t\t
Router::get('/
$r
/\{id\}', 'App\Controller
\\
"
.
$modelClass
.
"Controller@
$v
');"
;
}
}
}
}
...
...
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