1
|
|
|
<?php |
2
|
|
|
/* |
3
|
|
|
* For the full copyright and license information, please view the LICENSE |
4
|
|
|
* file that was distributed with this source code. |
5
|
|
|
* |
6
|
|
|
* @modified 8/11/20, 8:06 PM |
7
|
|
|
* @name toko |
8
|
|
|
* @author Wachid |
9
|
|
|
* @copyright Copyright (c) 2019-2020. |
10
|
|
|
*/ |
11
|
|
|
|
12
|
|
|
namespace Turahe\Master\Models; |
13
|
|
|
|
14
|
|
|
use Illuminate\Support\Facades\Cache; |
15
|
|
|
|
16
|
|
|
/** |
17
|
|
|
* Turahe\Master\Currency. |
18
|
|
|
* |
19
|
|
|
* @property int $id |
20
|
|
|
* @property null|int $priority |
21
|
|
|
* @property null|string $iso_code |
22
|
|
|
* @property null|string $name |
23
|
|
|
* @property null|string $symbol |
24
|
|
|
* @property null|string $disambiguate_symbol |
25
|
|
|
* @property null|string $alternate_symbols |
26
|
|
|
* @property null|string $subunit |
27
|
|
|
* @property int $subunit_to_unit |
28
|
|
|
* @property int $symbol_first |
29
|
|
|
* @property null|string $html_entity |
30
|
|
|
* @property null|string $decimal_mark |
31
|
|
|
* @property null|string $thousands_separator |
32
|
|
|
* @property null|string $iso_numeric |
33
|
|
|
* @property int $smallest_denomination |
34
|
|
|
* @property int $active |
35
|
|
|
* @property null|\Illuminate\Support\Carbon $created_at |
36
|
|
|
* @property null|\Illuminate\Support\Carbon $updated_at |
37
|
|
|
* |
38
|
|
|
* @method static \Illuminate\Database\Eloquent\Builder|Currency newModelQuery() |
39
|
|
|
* @method static \Illuminate\Database\Eloquent\Builder|Currency newQuery() |
40
|
|
|
* @method static \Illuminate\Database\Eloquent\Builder|Currency query() |
41
|
|
|
* @method static \Illuminate\Database\Eloquent\Builder|Currency whereActive($value) |
42
|
|
|
* @method static \Illuminate\Database\Eloquent\Builder|Currency whereAlternateSymbols($value) |
43
|
|
|
* @method static \Illuminate\Database\Eloquent\Builder|Currency whereCreatedAt($value) |
44
|
|
|
* @method static \Illuminate\Database\Eloquent\Builder|Currency whereDecimalMark($value) |
45
|
|
|
* @method static \Illuminate\Database\Eloquent\Builder|Currency whereDisambiguateSymbol($value) |
46
|
|
|
* @method static \Illuminate\Database\Eloquent\Builder|Currency whereHtmlEntity($value) |
47
|
|
|
* @method static \Illuminate\Database\Eloquent\Builder|Currency whereId($value) |
48
|
|
|
* @method static \Illuminate\Database\Eloquent\Builder|Currency whereIsoCode($value) |
49
|
|
|
* @method static \Illuminate\Database\Eloquent\Builder|Currency whereIsoNumeric($value) |
50
|
|
|
* @method static \Illuminate\Database\Eloquent\Builder|Currency whereName($value) |
51
|
|
|
* @method static \Illuminate\Database\Eloquent\Builder|Currency wherePriority($value) |
52
|
|
|
* @method static \Illuminate\Database\Eloquent\Builder|Currency whereSmallestDenomination($value) |
53
|
|
|
* @method static \Illuminate\Database\Eloquent\Builder|Currency whereSubunit($value) |
54
|
|
|
* @method static \Illuminate\Database\Eloquent\Builder|Currency whereSubunitToUnit($value) |
55
|
|
|
* @method static \Illuminate\Database\Eloquent\Builder|Currency whereSymbol($value) |
56
|
|
|
* @method static \Illuminate\Database\Eloquent\Builder|Currency whereSymbolFirst($value) |
57
|
|
|
* @method static \Illuminate\Database\Eloquent\Builder|Currency whereThousandsSeparator($value) |
58
|
|
|
* @method static \Illuminate\Database\Eloquent\Builder|Currency whereUpdatedAt($value) |
59
|
|
|
* @mixin \Eloquent |
60
|
|
|
*/ |
61
|
|
|
class Currency extends Model |
62
|
|
|
{ |
63
|
|
|
protected $table = 'tm_currencies'; |
64
|
|
|
|
65
|
|
|
/** |
66
|
|
|
* Bootstrap the model and its traits. |
67
|
|
|
* |
68
|
|
|
* Caching model when updating and |
69
|
|
|
* delete cache when delete models |
70
|
|
|
* |
71
|
|
|
* @return void |
72
|
|
|
*/ |
73
|
|
|
protected static function boot() |
74
|
|
|
{ |
75
|
|
|
parent::boot(); // TODO: Change the autogenerated stub |
76
|
|
|
static::updating(function ($instance) { |
77
|
|
|
Cache::put('currencies.'.$instance->slug, $instance); |
78
|
|
|
}); |
79
|
|
|
static::deleting(function ($instance) { |
80
|
|
|
Cache::delete('currencies.'.$instance->slug); |
81
|
|
|
}); |
82
|
|
|
} |
83
|
|
|
} |
84
|
|
|
|