1
|
|
|
<?php |
2
|
|
|
|
3
|
|
|
namespace App\Models; |
4
|
|
|
|
5
|
|
|
use Backpack\CRUD\app\Models\Traits\CrudTrait; |
6
|
|
|
use Illuminate\Database\Eloquent\Model; |
7
|
|
|
use Venturecraft\Revisionable\RevisionableTrait; |
8
|
|
|
|
9
|
|
|
class Icon extends Model |
10
|
|
|
{ |
11
|
|
|
use CrudTrait; |
|
|
|
|
12
|
|
|
use RevisionableTrait; |
|
|
|
|
13
|
|
|
|
14
|
|
|
/* |
15
|
|
|
|-------------------------------------------------------------------------- |
16
|
|
|
| GLOBAL VARIABLES |
17
|
|
|
|-------------------------------------------------------------------------- |
18
|
|
|
*/ |
19
|
|
|
|
20
|
|
|
protected $table = 'icons'; |
21
|
|
|
protected $primaryKey = 'id'; |
22
|
|
|
public $timestamps = true; |
23
|
|
|
// protected $guarded = ['id']; |
24
|
|
|
protected $fillable = ['name', 'icon']; |
25
|
|
|
// protected $hidden = []; |
26
|
|
|
// protected $dates = []; |
27
|
|
|
|
28
|
|
|
public function identifiableName() |
29
|
|
|
{ |
30
|
|
|
return 'icon'; |
31
|
|
|
} |
32
|
|
|
|
33
|
|
|
/* |
34
|
|
|
|-------------------------------------------------------------------------- |
35
|
|
|
| FUNCTIONS |
36
|
|
|
|-------------------------------------------------------------------------- |
37
|
|
|
*/ |
38
|
|
|
|
39
|
|
|
/* |
40
|
|
|
|-------------------------------------------------------------------------- |
41
|
|
|
| RELATIONS |
42
|
|
|
|-------------------------------------------------------------------------- |
43
|
|
|
*/ |
44
|
|
|
|
45
|
|
|
public function recommends() |
46
|
|
|
{ |
47
|
|
|
return $this->morphToMany(\App\Models\Recommend::class, 'recommendable'); |
48
|
|
|
} |
49
|
|
|
|
50
|
|
|
/* |
51
|
|
|
|-------------------------------------------------------------------------- |
52
|
|
|
| SCOPES |
53
|
|
|
|-------------------------------------------------------------------------- |
54
|
|
|
*/ |
55
|
|
|
|
56
|
|
|
/* |
57
|
|
|
|-------------------------------------------------------------------------- |
58
|
|
|
| ACCESORS |
59
|
|
|
|-------------------------------------------------------------------------- |
60
|
|
|
*/ |
61
|
|
|
|
62
|
|
|
/* |
63
|
|
|
|-------------------------------------------------------------------------- |
64
|
|
|
| MUTATORS |
65
|
|
|
|-------------------------------------------------------------------------- |
66
|
|
|
*/ |
67
|
|
|
} |
68
|
|
|
|