DatastoreDatastoreRepository::paginateAccepted()   A
last analyzed

Complexity

Conditions 3
Paths 1

Size

Total Lines 12
Code Lines 7

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 3
eloc 7
c 0
b 0
f 0
nc 1
nop 5
dl 0
loc 12
rs 10
1
<?php
2
3
namespace Phpsa\Datastore\Repositories;
4
5
6
use App\Repositories\BaseRepository;
0 ignored issues
show
Bug introduced by
The type App\Repositories\BaseRepository 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. excluded_paths: ["lib/*"], you can move it to the dependency path list as follows:

filter:
    dependency_paths: ["lib/*"]

For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths

Loading history...
7
use Phpsa\Datastore\Models\DatastoreDatastore;
8
/**
9
 * Class PermissionRepository.
10
 */
11
class DatastoreDatastoreRepository extends BaseRepository
12
{
13
    /**
14
     * @return string
15
     */
16
    public function model()
17
    {
18
        return DatastoreDatastore::class;
19
	}
20
21
	public function paginateAccepted($datastore_id, $status = NULL, $limit = 25, $pageName = 'page', $page = null){
22
		$this->where('datastore2_id', $datastore_id)->with('datastore');
23
24
			$this->whereHas('datastore', function($query) use ($status) {
25
				if($status){
26
					if(!is_array($status)){
27
						$status = [$status];
28
					}
29
					$query->whereIn('status', $status);
30
				}
31
			});
32
		return $this->paginate($limit, ['*'], $pageName, $page);
33
	}
34
35
	/*
36
	$ids = DatastoreDatastore::whereHas('child', function($query){
37
			$query->where('status', '=', 'published');
38
		})->where('datastore2_id', $page->asset)->get(['datastore_id'])->pluck('datastore_id')->toArray();
39
		*/
40
}
41