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