Skip to content

Commit cf7e262

Browse files
committed
修正
1 parent ffb36c5 commit cf7e262

File tree

1 file changed

+3
-4
lines changed

1 file changed

+3
-4
lines changed

src/InteractsWithModel.php

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -65,11 +65,10 @@ protected function detectModelAnnotations()
6565

6666
$this->app->event->listen(ModelGenerator::class, function (ModelGenerator $generator) {
6767

68-
$attrs = $this->reader->getAnnotations($generator->getReflection(), Relation::class);
68+
$annotations = $this->reader->getAnnotations($generator->getReflection(), Relation::class);
6969

70-
foreach ($attrs as $attr) {
71-
$annotation = $attr->newInstance();
72-
$property = Str::snake($annotation->name);
70+
foreach ($annotations as $annotation) {
71+
$property = Str::snake($annotation->name);
7372
switch (true) {
7473
case $annotation instanceof HasOne:
7574
$generator->addMethod($annotation->name, \think\model\relation\HasOne::class, [], '');

0 commit comments

Comments
 (0)