1
|
|
|
<?php |
2
|
|
|
|
3
|
|
|
namespace FaithGen\Sermons\Models; |
4
|
|
|
|
5
|
|
|
use FaithGen\SDK\Models\UuidModel; |
6
|
|
|
use FaithGen\SDK\Traits\Relationships\Belongs\BelongsToMinistryTrait; |
7
|
|
|
use FaithGen\SDK\Traits\Relationships\Morphs\CommentableTrait; |
8
|
|
|
use FaithGen\SDK\Traits\Relationships\Morphs\ImageableTrait; |
9
|
|
|
use FaithGen\SDK\Traits\StorageTrait; |
10
|
|
|
use FaithGen\SDK\Traits\TitleTrait; |
11
|
|
|
|
12
|
|
|
class Sermon extends UuidModel |
13
|
|
|
{ |
14
|
|
|
use CommentableTrait, BelongsToMinistryTrait, StorageTrait, TitleTrait, ImageableTrait; |
15
|
|
|
|
16
|
|
|
protected $table = 'fg_sermons'; |
17
|
|
|
protected $casts = [ |
18
|
|
|
'main_verses' => 'array', |
19
|
|
|
'reference_verses' => 'array', |
20
|
|
|
]; |
21
|
|
|
|
22
|
|
|
//****************************************************************************// |
23
|
|
|
//***************************** MODEL ATTRIBUTES *****************************// |
24
|
|
|
//****************************************************************************// |
25
|
|
|
public function getPreacherAttribute($val) |
26
|
|
|
{ |
27
|
|
|
return ucwords($val); |
28
|
|
|
} |
29
|
|
|
|
30
|
|
|
public function getSermonAttribute($val) |
31
|
|
|
{ |
32
|
|
|
return ucfirst($val); |
33
|
|
|
} |
34
|
|
|
|
35
|
|
|
//****************************************************************************// |
36
|
|
|
//***************************** MODEL ATTRIBUTES *****************************// |
37
|
|
|
//****************************************************************************// |
38
|
|
|
|
39
|
|
|
public function formatVerse($verse) |
40
|
|
|
{ |
41
|
|
|
ucwords($verse); |
42
|
|
|
|
43
|
|
|
return true; |
44
|
|
|
} |
45
|
|
|
|
46
|
|
|
public function filesDir() |
47
|
|
|
{ |
48
|
|
|
return 'sermons'; |
49
|
|
|
} |
50
|
|
|
|
51
|
|
|
public function getFileName() |
52
|
|
|
{ |
53
|
|
|
return $this->image->name; |
|
|
|
|
54
|
|
|
} |
55
|
|
|
} |
56
|
|
|
|
Checks if undeclared accessed properties appear in database migrations and if the creating migration is correct.