1
|
|
|
<?php |
2
|
|
|
|
3
|
|
|
namespace App\Models; |
4
|
|
|
|
5
|
|
|
use App\Http\Resources\ContactMessageResource; |
6
|
|
|
use App\Traits\Hashidable; |
7
|
|
|
use Illuminate\Database\Eloquent\Model; |
8
|
|
|
|
9
|
|
|
/** |
10
|
|
|
* App\Models\ContactMessage. |
11
|
|
|
* |
12
|
|
|
* @property int $id |
13
|
|
|
* @property string $name |
14
|
|
|
* @property string $email |
15
|
|
|
* @property string|null $position |
16
|
|
|
* @property string $subject |
17
|
|
|
* @property string $body |
18
|
|
|
* @property \Illuminate\Support\Carbon|null $created_at |
19
|
|
|
* @property \Illuminate\Support\Carbon|null $updated_at |
20
|
|
|
* @property-read string $hashed_id |
21
|
|
|
* @method static \Illuminate\Database\Eloquent\Builder|ContactMessage findByHashedId(string $hashedId) |
22
|
|
|
* @method static \Illuminate\Database\Eloquent\Builder|ContactMessage newModelQuery() |
23
|
|
|
* @method static \Illuminate\Database\Eloquent\Builder|ContactMessage newQuery() |
24
|
|
|
* @method static \Illuminate\Database\Eloquent\Builder|ContactMessage query() |
25
|
|
|
* @method static \Illuminate\Database\Eloquent\Builder|ContactMessage whereBody($value) |
26
|
|
|
* @method static \Illuminate\Database\Eloquent\Builder|ContactMessage whereCreatedAt($value) |
27
|
|
|
* @method static \Illuminate\Database\Eloquent\Builder|ContactMessage whereEmail($value) |
28
|
|
|
* @method static \Illuminate\Database\Eloquent\Builder|ContactMessage whereId($value) |
29
|
|
|
* @method static \Illuminate\Database\Eloquent\Builder|ContactMessage whereName($value) |
30
|
|
|
* @method static \Illuminate\Database\Eloquent\Builder|ContactMessage wherePosition($value) |
31
|
|
|
* @method static \Illuminate\Database\Eloquent\Builder|ContactMessage whereSubject($value) |
32
|
|
|
* @method static \Illuminate\Database\Eloquent\Builder|ContactMessage whereUpdatedAt($value) |
33
|
|
|
* @mixin \Eloquent |
34
|
|
|
*/ |
35
|
|
|
class ContactMessage extends Model |
36
|
|
|
{ |
37
|
|
|
use Hashidable; |
38
|
|
|
|
39
|
|
|
/** |
40
|
|
|
* The table associated with the model. |
41
|
|
|
* |
42
|
|
|
* @var string |
43
|
|
|
*/ |
44
|
|
|
protected $table = 'contact_messages'; |
45
|
|
|
|
46
|
|
|
/** |
47
|
|
|
* The attributes that are mass assignable. |
48
|
|
|
* |
49
|
|
|
* @var array |
50
|
|
|
*/ |
51
|
|
|
protected $fillable = [ |
52
|
|
|
'name', |
53
|
|
|
'email', |
54
|
|
|
'position', |
55
|
|
|
'subject', |
56
|
|
|
'body', |
57
|
|
|
]; |
58
|
|
|
|
59
|
|
|
/** |
60
|
|
|
* The accessors to append to the model's array form. |
61
|
|
|
* |
62
|
|
|
* @var array |
63
|
|
|
*/ |
64
|
|
|
protected $appends = ['hashed_id']; |
65
|
|
|
|
66
|
|
|
/* |
67
|
|
|
* ----------------------------------------------------------------- * |
68
|
|
|
* --------------------------- Accessors --------------------------- * |
69
|
|
|
* ----------------------------------------------------------------- * |
70
|
|
|
*/ |
71
|
|
|
|
72
|
|
|
/* |
73
|
|
|
* ----------------------------------------------------------------- * |
74
|
|
|
* ---------------------------- Mutators --------------------------- * |
75
|
|
|
* ----------------------------------------------------------------- * |
76
|
|
|
*/ |
77
|
|
|
|
78
|
|
|
/* |
79
|
|
|
* ----------------------------------------------------------------- * |
80
|
|
|
* ----------------------------- Scopes ---------------------------- * |
81
|
|
|
* ----------------------------------------------------------------- * |
82
|
|
|
*/ |
83
|
|
|
|
84
|
|
|
/* |
85
|
|
|
* ----------------------------------------------------------------- * |
86
|
|
|
* ------------------------------ Misc ----------------------------- * |
87
|
|
|
* ----------------------------------------------------------------- * |
88
|
|
|
*/ |
89
|
|
|
|
90
|
|
|
/** |
91
|
|
|
* Convert the model instance to an array. |
92
|
|
|
* |
93
|
|
|
* @return array |
94
|
|
|
*/ |
95
|
|
|
public function toArray() |
96
|
|
|
{ |
97
|
|
|
return ContactMessageResource::make($this)->toArray(request()); |
98
|
|
|
} |
99
|
|
|
} |
100
|
|
|
|