Template   A
last analyzed

Complexity

Total Complexity 1

Size/Duplication

Total Lines 45
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 1

Importance

Changes 5
Bugs 1 Features 3
Metric Value
wmc 1
c 5
b 1
f 3
lcom 0
cbo 1
dl 0
loc 45
rs 10

1 Method

Rating   Name   Duplication   Size   Complexity  
A detail() 0 4 1
1
<?php namespace App\LaravelRestCms\Template;
2
3
use App\LaravelRestCms\BaseModel;
4
use App\LaravelRestCms\Template\TemplateDetail;
5
6
class Template extends BaseModel {
7
8
	public static $searchCols = ['name', 'class'];
9
10
	/**
11
	 * The database table used by the model.
12
	 *
13
	 * @var string
14
	 */
15
	protected $table = 'templates';
16
17
	/**
18
	 * The attributes that are mass assignable.
19
	 *
20
	 * @var array
21
	 */
22
	protected $fillable = [];
23
24
	/**
25
	 * The attributes excluded from the model's JSON form.
26
	 *
27
	 * @var array
28
	 */
29
	protected $hidden = [];
30
31
	/**
32
	 * Rules to validate when creating a model
33
	 * 
34
	 * @var array
35
	 */
36
	protected static $createRules = [		
37
		'name' => 'required|unique:templates',
38
	];
39
40
	/**
41
	 * Joins the page_detail table
42
	 * 
43
	 * @return \Illuminate\Database\Eloquent\Relations\HasMany
44
	 */
45
	public function detail()
46
	{
47
		return $this->hasMany(TemplateDetail::class, 'template_id', 'id');
48
	}
49
    
50
}
51