Total Complexity | 5 |
Total Lines | 48 |
Duplicated Lines | 0 % |
Changes | 2 | ||
Bugs | 0 | Features | 0 |
1 | <?php |
||
9 | class SermonService extends CRUDServices |
||
10 | { |
||
11 | use FileTraits; |
||
12 | /** |
||
13 | * @var Sermon |
||
14 | */ |
||
15 | protected Sermon $sermon; |
||
16 | |||
17 | public function __construct() |
||
18 | { |
||
19 | $this->sermon = app(Sermon::class); |
||
20 | |||
21 | $sermonId = request()->route('sermon') ?? request('sermon_id'); |
||
22 | |||
23 | if ($sermonId) { |
||
24 | $this->sermon = $this->sermon->resolveRouteBinding($sermonId); |
||
25 | } |
||
26 | } |
||
27 | |||
28 | /** |
||
29 | * Retrieves an instance of sermon. |
||
30 | * |
||
31 | * @return \FaithGen\Sermons\Models\Sermon |
||
32 | */ |
||
33 | public function getSermon(): Sermon |
||
36 | } |
||
37 | |||
38 | /** |
||
39 | * Makes a list of fields that you do not want to be sent |
||
40 | * to the create or update methods. |
||
41 | * Its mainly the fields that you do not have in the messages table. |
||
42 | * |
||
43 | * @return array |
||
44 | */ |
||
45 | public function getUnsetFields(): array |
||
46 | { |
||
47 | return ['sermon_id', 'image']; |
||
48 | } |
||
49 | |||
50 | /** |
||
51 | * This gets the relationship of the given model to the parent. |
||
52 | * @return mixed |
||
53 | */ |
||
54 | public function getParentRelationship() |
||
57 | } |
||
58 | } |
||
59 |