1 | <?php |
||
2 | namespace Hideyo\Ecommerce\Framework\Services; |
||
3 | |||
4 | use Illuminate\Database\Eloquent\Model; |
||
5 | |||
6 | class BaseModel extends Model |
||
7 | { |
||
8 | /** |
||
9 | * construct |
||
10 | * @param array $attributes |
||
11 | */ |
||
12 | public function __construct(array $attributes = array()) |
||
13 | { |
||
14 | $this->table = $this->table; |
||
15 | parent::__construct($attributes); |
||
16 | } |
||
17 | |||
18 | /** |
||
19 | * check existing slug |
||
20 | * @param string $slug |
||
21 | * @return object |
||
22 | */ |
||
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); |
||
0 ignored issues
–
show
|
|||
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; |
||
0 ignored issues
–
show
The type
Hideyo\Ecommerce\Framework\Services\Collection was not found. Maybe you did not declare it correctly or list all dependencies?
The issue could also be caused by a filter entry in the build configuration.
If the path has been excluded in your configuration, e.g. filter:
dependency_paths: ["lib/*"]
For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths ![]() |
|||
46 | } |
||
47 | } |
Checks if undeclared accessed properties appear in database migrations and if the creating migration is correct.