| @@ 38-47 (lines=10) @@ | ||
| 35 | return $this->query->first(); |
|
| 36 | } |
|
| 37 | ||
| 38 | public function create(array $values = []) |
|
| 39 | { |
|
| 40 | $class = $this->foreignModel; |
|
| 41 | $model = new $class(); |
|
| 42 | $model->create($values); |
|
| 43 | ||
| 44 | $this->attach($model); |
|
| 45 | ||
| 46 | return $model; |
|
| 47 | } |
|
| 48 | ||
| 49 | /** |
|
| 50 | * Attaches this model to an owning model. |
|
| @@ 71-80 (lines=10) @@ | ||
| 68 | return $this->tablename; |
|
| 69 | } |
|
| 70 | ||
| 71 | public function create(array $values = []) |
|
| 72 | { |
|
| 73 | $class = $this->foreignModel; |
|
| 74 | $model = new $class(); |
|
| 75 | $model->create($values); |
|
| 76 | ||
| 77 | $this->attach($model); |
|
| 78 | ||
| 79 | return $model; |
|
| 80 | } |
|
| 81 | ||
| 82 | /** |
|
| 83 | * Attaches a model to the relationship by creating |
|