1 | <?php namespace Arcanedev\LaravelNotes\Models; |
||
20 | class Note extends AbstractModel |
||
21 | { |
||
22 | /* ----------------------------------------------------------------- |
||
23 | | Properties |
||
24 | | ----------------------------------------------------------------- |
||
25 | */ |
||
26 | |||
27 | /** |
||
28 | * The attributes that are mass assignable. |
||
29 | * |
||
30 | * @var array |
||
31 | */ |
||
32 | protected $fillable = ['content', 'author_id']; |
||
33 | |||
34 | /** |
||
35 | * The attributes excluded from the model's JSON form. |
||
36 | * |
||
37 | * @var array |
||
38 | */ |
||
39 | protected $hidden = ['noteable_id', 'noteable_type']; |
||
40 | |||
41 | /** |
||
42 | * The attributes that should be cast to native types. |
||
43 | * |
||
44 | * @var array |
||
45 | */ |
||
46 | protected $casts = [ |
||
47 | 'id' => 'integer', |
||
48 | 'noteable_id' => 'integer', |
||
49 | 'author_id' => 'integer', |
||
50 | ]; |
||
51 | |||
52 | /* ----------------------------------------------------------------- |
||
53 | | Constructor |
||
54 | | ----------------------------------------------------------------- |
||
55 | */ |
||
56 | |||
57 | /** |
||
58 | * Note constructor. |
||
59 | * |
||
60 | * @param array $attributes |
||
61 | */ |
||
62 | 18 | public function __construct(array $attributes = []) |
|
68 | |||
69 | /* ----------------------------------------------------------------- |
||
70 | | Relationship |
||
71 | | ----------------------------------------------------------------- |
||
72 | */ |
||
73 | |||
74 | /** |
||
75 | * The noteable relationship. |
||
76 | * |
||
77 | * @return \Illuminate\Database\Eloquent\Relations\MorphTo |
||
78 | */ |
||
79 | 3 | public function noteable() |
|
83 | |||
84 | /** |
||
85 | * The author relationship. |
||
86 | * |
||
87 | * @return \Illuminate\Database\Eloquent\Relations\BelongsTo |
||
88 | */ |
||
89 | 9 | public function author() |
|
93 | } |
||
94 |