Completed
Push — master ( 509012...3eafe2 )
by David
02:34
created

Page::template()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 1
Metric Value
c 1
b 0
f 1
dl 0
loc 4
rs 10
cc 1
eloc 2
nc 1
nop 0
1
<?php namespace App\LaravelRestCms\Page;
2
3
use App\LaravelRestCms\BaseModel;
4
use App\LaravelRestCms\Page\PageDetail;
5
use App\LaravelRestCms\Template\Template;
6
7
class Page extends BaseModel {
8
9
	public static $searchCols = ['nav_name', 'url', 'title'];
10
11
	/**
12
	 * The database table used by the model.
13
	 *
14
	 * @var string
15
	 */
16
	protected $table = 'pages';
17
18
	/**
19
	 * The attributes that are mass assignable.
20
	 *
21
	 * @var array
22
	 */
23
	protected $fillable = [];
24
25
	/**
26
	 * The attributes excluded from the model's JSON form.
27
	 *
28
	 * @var array
29
	 */
30
	protected $hidden = [];
31
32
	/**
33
	 * Joins the page_detail table
34
	 * 
35
	 * @return \Illuminate\Database\Eloquent\Relations\HasMany
36
	 */
37
	public function detail()
38
    {
39
        return $this->hasMany(PageDetail::class, 'page_id', 'id');
40
    }
41
42
	/**
43
	 * Joins the templates table
44
	 * 
45
	 * @return \Illuminate\Database\Eloquent\Relations\hasOne
46
	 */
47
	public function template()
48
    {
49
        return $this->hasMany(Template::class, 'id', 'template_id');
50
    }
51
52
}
53