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