Datastore   A
last analyzed

Complexity

Total Complexity 6

Size/Duplication

Total Lines 51
Duplicated Lines 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
eloc 14
c 1
b 0
f 0
dl 0
loc 51
rs 10
wmc 6

6 Methods

Rating   Name   Duplication   Size   Complexity  
A page() 0 3 1
A assets() 0 3 1
A parents() 0 2 1
A comments() 0 3 1
A items() 0 2 1
A properties() 0 3 1
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