Conditions | 4 |
Paths | 4 |
Total Lines | 23 |
Code Lines | 10 |
Lines | 0 |
Ratio | 0 % |
Changes | 0 |
1 | <?php |
||
23 | protected function getExistingSlugs($slug) |
||
24 | { |
||
25 | $config = $this->getSluggableConfig(); |
||
26 | $saveTo = $config['save_to']; |
||
27 | $includeTrashed = $config['include_trashed']; |
||
28 | |||
29 | $instance = new static; |
||
30 | |||
31 | $query = $instance->where($saveTo, 'LIKE', $slug . '%'); |
||
32 | |||
33 | // @overriden - changed this to scope unique slugs per user |
||
34 | $query = $query->where('shop_id', $this->shop_id); |
||
|
|||
35 | |||
36 | // include trashed models if required |
||
37 | if ($includeTrashed && $this->usesSoftDeleting()) { |
||
38 | $query = $query->withTrashed(); |
||
39 | } |
||
40 | |||
41 | // get a list of all matching slugs |
||
42 | $list = $query->pluck($saveTo, $this->getKeyName())->toArray(); |
||
43 | |||
44 | // Laravel 5.0/5.1 check |
||
45 | return $list instanceof Collection ? $list->all() : $list; |
||
46 | } |
||
47 | } |
Checks if undeclared accessed properties appear in database migrations and if the creating migration is correct.