Total Complexity | 3 |
Total Lines | 44 |
Duplicated Lines | 0 % |
Changes | 0 |
1 | <?php |
||
8 | class TimeLog extends Model |
||
9 | { |
||
10 | /* @var array $fillable The fields which are mass assignable */ |
||
11 | protected $fillable = ['project_id', 'user_id', 'number_of_seconds']; |
||
12 | |||
13 | /** |
||
14 | * The event map for the model. |
||
15 | * |
||
16 | * @var array |
||
17 | */ |
||
18 | protected $dispatchesEvents = [ |
||
19 | 'saved' => TimeLogSaved::class |
||
20 | ]; |
||
21 | |||
22 | public $appends = ['number_of_seconds_for_humans']; |
||
23 | |||
24 | /** |
||
25 | * A time log belongs to a project |
||
26 | * |
||
27 | * @return \Illuminate\Database\Eloquent\Relations\BelongsTo |
||
28 | */ |
||
29 | public function project() |
||
30 | { |
||
31 | return $this->belongsTo(Project::class); |
||
32 | } |
||
33 | |||
34 | /** |
||
35 | * A time log belongs to a user |
||
36 | * |
||
37 | * @return \Illuminate\Database\Eloquent\Relations\BelongsTo |
||
38 | */ |
||
39 | public function user() |
||
42 | } |
||
43 | |||
44 | /** |
||
45 | * Get the number of seconds for humans attribute |
||
46 | * |
||
47 | * @return string |
||
48 | */ |
||
49 | public function getNumberOfSecondsForHumansAttribute() |
||
54 |