Datastore::items()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 2
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 1
eloc 1
c 0
b 0
f 0
nc 1
nop 0
dl 0
loc 2
rs 10
1
<?php
2
3
namespace Phpsa\Datastore\Models;
4
5
use Illuminate\Database\Eloquent\Model;
6
use Phpsa\Datastore\Datastore as DatastoreFactory;
7
use Phpsa\Datastore\Models\Traits\Attribute\DatastoreAttribute;
8
use Phpsa\Datastore\Models\DatastorePages;
9
use Phpsa\Datastore\Models\DatastoreComments;
10
use Phpsa\Datastore\Helpers;
11
12
class Datastore extends Model
13
{
14
15
	use DatastoreAttribute;
1 ignored issue
show
introduced by
The trait Phpsa\Datastore\Models\T...bute\DatastoreAttribute requires some properties which are not provided by Phpsa\Datastore\Models\Datastore: $delete_button, $edit_button, $content_path, $type
Loading history...
16
17
	protected $table = 'datastore';
18
19
	/**
20
     * @var array
21
     */
22
    protected $dates = [
23
        'start_date',
24
		'end_date',
25
		'updated_at',
26
		'created_at'
27
	];
28
29
30
	public function properties()
31
    {
32
        return $this->hasMany(Datastore::class);
33
    }
34
35
	public function assets()
36
	{
37
		return $this->belongsTo(Datastore::class, 'datastore_id');
38
	}
39
40
	public function page()
41
	{
42
		return $this->hasOne(DatastorePages::class, 'asset');
43
	}
44
45
	public function items(){
46
		return $this->hasMany(DatastoreDatastore::class, 'datastore2_id', 'id');
47
	}
48
49
	public function parents(){
50
		return $this->hasManyThrough(self::class, DatastoreDatastore::class, 'datastore_id', 'id', 'id', 'datastore2_id');
51
52
	}
53
54
55
	/**
56
     * The has Many Relationship
57
     *
58
     * @var array
59
     */
60
    public function comments()
61
    {
62
        return $this->hasMany(DatastoreComments::class)->whereNull('parent_id');
63
    }
64
65
66
67
68
}
69