-
Notifications
You must be signed in to change notification settings - Fork 77
/
Copy pathTag.php
59 lines (51 loc) · 1.44 KB
/
Tag.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
<?php
namespace App;
use Carbon\Carbon;
use Illuminate\Database\Eloquent\Model;
class Tag extends Model
{
//
use \Dimsav\Translatable\Translatable;
public $translatedAttributes = ['title'];
public $sluggable = ['slug'];
protected $fillable = ['title','slug'];
protected $fieldspec = [];
// set the specifications for this database table
function getFieldSpec ()
{
// build array of field specifications
$this->fieldspec['id'] = [
'type' => 'integer',
'minvalue' => 0,
'pkey' => 'y',
'required' => true,
'label' => 'id',
'hidden' => '1',
'display' => '0',
];
$this->fieldspec['title'] = [
'type' => 'string',
'required' => true,
'hidden' => '0',
'label' => 'Title',
'extraMsg' => '',
'display' => '1',
];
$this->fieldspec['slug'] = [
'type' => 'string',
'required' => false,
'hidden' => '0',
'label' => 'Slug',
'extraMsg' => '',
'display' => '1',
];
return $this->fieldspec;
}
/*
* Get news associates with the tags
* Illuminate\Database\Eloquent\Relations\BelongsToMany
*/
public function news(){
return $this->belongsToMany('App\News');
}
}