Conditions | 1 |
Paths | 1 |
Total Lines | 11 |
Code Lines | 6 |
Lines | 0 |
Ratio | 0 % |
Changes | 1 | ||
Bugs | 0 | Features | 0 |
1 | <?php namespace Darryldecode\Cart; |
||
7 | public function associate($model, $field = 'id'){ |
||
8 | |||
9 | $associated = new $model; |
||
10 | |||
11 | $this->transform(function($item, $key) use ($associated, $field) { |
||
12 | $item['association'] = $associated->where($field,$key)->first(); |
||
13 | return $item; |
||
14 | }); |
||
15 | |||
16 | return $this; |
||
17 | } |
||
18 | |||
19 | } |