1 | <?php |
||
2 | |||
0 ignored issues
–
show
Coding Style
introduced
by
![]() |
|||
3 | namespace BristolSU\Module\StaticPage\Models; |
||
4 | |||
5 | use BristolSU\ControlDB\Contracts\Repositories\User; |
||
6 | use BristolSU\Support\ActivityInstance\Contracts\ActivityInstanceRepository; |
||
7 | use BristolSU\Support\Authentication\HasResource; |
||
8 | use BristolSU\Support\ModuleInstance\Contracts\ModuleInstanceRepository; |
||
9 | use Illuminate\Database\Eloquent\Model; |
||
10 | |||
11 | class PageView extends Model |
||
0 ignored issues
–
show
|
|||
12 | { |
||
13 | use HasResource; |
||
14 | |||
15 | protected $table = 'static_page_page_views'; |
||
16 | |||
17 | protected $appends = [ |
||
18 | 'user', 'activity_instance', 'module_instance' |
||
19 | ]; |
||
20 | |||
21 | protected $fillable = [ |
||
22 | 'viewed_by' |
||
23 | ]; |
||
24 | |||
25 | 5 | public function getUserAttribute() |
|
0 ignored issues
–
show
|
|||
26 | { |
||
27 | 5 | return app(User::class)->getById($this->viewed_by); |
|
28 | } |
||
29 | |||
30 | 3 | public function getActivityInstanceAttribute() |
|
0 ignored issues
–
show
|
|||
31 | { |
||
32 | 3 | return app(ActivityInstanceRepository::class)->getById($this->activity_instance_id); |
|
33 | } |
||
34 | |||
35 | 3 | public function getModuleInstanceAttribute() |
|
0 ignored issues
–
show
|
|||
36 | { |
||
37 | 3 | return app(ModuleInstanceRepository::class)->getById($this->module_instance_id); |
|
38 | } |
||
39 | |||
40 | } |