Code Coverage
 
Lines
Functions and Methods
Classes and Traits
Total
0.00% covered (danger)
0.00%
0 / 2
0.00% covered (danger)
0.00%
0 / 2
CRAP
0.00% covered (danger)
0.00%
0 / 1
FlyCutUsage
0.00% covered (danger)
0.00%
0 / 2
0.00% covered (danger)
0.00%
0 / 2
6
0.00% covered (danger)
0.00%
0 / 1
 user
0.00% covered (danger)
0.00%
0 / 1
0.00% covered (danger)
0.00%
0 / 1
2
 shortcut
0.00% covered (danger)
0.00%
0 / 1
0.00% covered (danger)
0.00%
0 / 1
2
1<?php
2
3namespace App\Http\Models;
4
5use App\Http\Models\Auth\User;
6use App\Observers\FlyCutUsageObserver;
7use Illuminate\Database\Eloquent\Attributes\ObservedBy;
8use Illuminate\Database\Eloquent\Factories\HasFactory;
9use Illuminate\Notifications\Notifiable;
10
11#[ObservedBy([FlyCutUsageObserver::class])]
12class FlyCutUsage extends Moloquent
13{
14    use HasFactory, Notifiable;
15
16    /**
17     * Number of words users type per minute
18     *
19     * @var int
20     */
21    public const WORDS_PER_MINUTE = 40;
22
23    /**
24     * Estimated amount of earnings per hour for an average U.S worker (in USD)
25     *
26     * @var float
27     */
28    public const WAGE_PER_HOUR = 31.65;
29
30    /**
31     * The table associated with the model.
32     *
33     * @var string
34     */
35    protected $table = 'flycut_usage';
36
37    /**
38     * The attributes that are mass assignable.
39     *
40     * @var array
41     */
42    protected $fillable = [
43        'user_id',
44        'shortcut_id',
45        'characters_typed',
46        'shortcut_characters',
47        'characters_saved',
48        'time_saved',
49        'cost_saved',
50        'executed_at',
51        'executed_at_raw',
52        'feature',
53    ];
54
55    /**
56     *  Get the user that owns the flycut usage
57     *
58     * @return \Illuminate\Database\Eloquent\Relations\BelongsTo
59     */
60    public function user()
61    {
62        return $this->belongsTo(User::class);
63    }
64
65    /**
66     *  Get the shortcut that owns the flycut usage
67     *
68     * @return \Illuminate\Database\Eloquent\Relations\BelongsTo
69     */
70    public function shortcut()
71    {
72        return $this->belongsTo(ShortcutWithUsage::class);
73    }
74}