1
|
|
|
<?php |
2
|
|
|
namespace Turahe\Counters\Models; |
3
|
|
|
|
4
|
|
|
use Turahe\Counters\Facades\Counters; |
5
|
|
|
use Illuminate\Database\Eloquent\Model; |
6
|
|
|
|
7
|
|
|
/** |
8
|
|
|
* Turahe\Counters\Models\Counter |
9
|
|
|
* |
10
|
|
|
* @property int $id |
11
|
|
|
* @property string $key |
12
|
|
|
* @property string $name |
13
|
|
|
* @property float $initial_value |
14
|
|
|
* @property float $value |
15
|
|
|
* @property float $step |
16
|
|
|
* @property string|null $notes |
17
|
|
|
* @property \Illuminate\Support\Carbon|null $created_at |
18
|
|
|
* @property \Illuminate\Support\Carbon|null $updated_at |
19
|
|
|
* @method static \Illuminate\Database\Eloquent\Builder|Counter newModelQuery() |
20
|
|
|
* @method static \Illuminate\Database\Eloquent\Builder|Counter newQuery() |
21
|
|
|
* @method static \Illuminate\Database\Eloquent\Builder|Counter query() |
22
|
|
|
* @method static \Illuminate\Database\Eloquent\Builder|Counter whereCreatedAt($value) |
23
|
|
|
* @method static \Illuminate\Database\Eloquent\Builder|Counter whereId($value) |
24
|
|
|
* @method static \Illuminate\Database\Eloquent\Builder|Counter whereInitialValue($value) |
25
|
|
|
* @method static \Illuminate\Database\Eloquent\Builder|Counter whereKey($value) |
26
|
|
|
* @method static \Illuminate\Database\Eloquent\Builder|Counter whereName($value) |
27
|
|
|
* @method static \Illuminate\Database\Eloquent\Builder|Counter whereNotes($value) |
28
|
|
|
* @method static \Illuminate\Database\Eloquent\Builder|Counter whereStep($value) |
29
|
|
|
* @method static \Illuminate\Database\Eloquent\Builder|Counter whereUpdatedAt($value) |
30
|
|
|
* @method static \Illuminate\Database\Eloquent\Builder|Counter whereValue($value) |
31
|
|
|
* @mixin \Eloquent |
32
|
|
|
*/ |
33
|
|
|
class Counter extends Model |
34
|
|
|
{ |
35
|
|
|
/** |
36
|
|
|
* The attributes that are mass assignable. |
37
|
|
|
* |
38
|
|
|
* @var array |
39
|
|
|
*/ |
40
|
|
|
protected $fillable = [ |
41
|
|
|
'key', |
42
|
|
|
'name', |
43
|
|
|
'value', |
44
|
|
|
'initial_value', |
45
|
|
|
'step', |
46
|
|
|
]; |
47
|
|
|
|
48
|
|
|
/** |
49
|
|
|
* @return mixed |
50
|
|
|
*/ |
51
|
|
|
public function getIncrementUrl() |
52
|
|
|
{ |
53
|
|
|
return Counters::getIncrementUrl($this->key); |
|
|
|
|
54
|
|
|
} |
55
|
|
|
|
56
|
|
|
/** |
57
|
|
|
* @return mixed |
58
|
|
|
*/ |
59
|
|
|
public function getDecrementUrl() |
60
|
|
|
{ |
61
|
|
|
return Counters::getDecrementUrl($this->key); |
|
|
|
|
62
|
|
|
} |
63
|
|
|
} |
64
|
|
|
|