1
|
|
|
<?php |
2
|
|
|
|
3
|
|
|
namespace Turahe\Master\Models; |
4
|
|
|
|
5
|
|
|
use Illuminate\Support\Facades\Cache; |
6
|
|
|
|
7
|
|
|
/** |
8
|
|
|
* Turahe\Master\Timezone. |
9
|
|
|
* |
10
|
|
|
* @property int $id |
11
|
|
|
* @property null|string $value |
12
|
|
|
* @property null|string $abbr |
13
|
|
|
* @property null|int $offset |
14
|
|
|
* @property null|int $isdst |
15
|
|
|
* @property null|string $text |
16
|
|
|
* @property null|string $utc |
17
|
|
|
* @property null|\Illuminate\Support\Carbon $created_at |
18
|
|
|
* @property null|\Illuminate\Support\Carbon $updated_at |
19
|
|
|
* |
20
|
|
|
* @method static \Illuminate\Database\Eloquent\Builder|Timezone newModelQuery() |
21
|
|
|
* @method static \Illuminate\Database\Eloquent\Builder|Timezone newQuery() |
22
|
|
|
* @method static \Illuminate\Database\Eloquent\Builder|Timezone query() |
23
|
|
|
* @method static \Illuminate\Database\Eloquent\Builder|Timezone whereAbbr($value) |
24
|
|
|
* @method static \Illuminate\Database\Eloquent\Builder|Timezone whereCreatedAt($value) |
25
|
|
|
* @method static \Illuminate\Database\Eloquent\Builder|Timezone whereId($value) |
26
|
|
|
* @method static \Illuminate\Database\Eloquent\Builder|Timezone whereIsdst($value) |
27
|
|
|
* @method static \Illuminate\Database\Eloquent\Builder|Timezone whereOffset($value) |
28
|
|
|
* @method static \Illuminate\Database\Eloquent\Builder|Timezone whereText($value) |
29
|
|
|
* @method static \Illuminate\Database\Eloquent\Builder|Timezone whereUpdatedAt($value) |
30
|
|
|
* @method static \Illuminate\Database\Eloquent\Builder|Timezone whereUtc($value) |
31
|
|
|
* @method static \Illuminate\Database\Eloquent\Builder|Timezone whereValue($value) |
32
|
|
|
* @mixin \Eloquent |
33
|
|
|
*/ |
34
|
|
|
class Timezone extends Model |
35
|
|
|
{ |
36
|
|
|
protected $table = 'tm_timezones'; |
37
|
|
|
|
38
|
|
|
/** |
39
|
|
|
* Bootstrap the model and its traits. |
40
|
|
|
* |
41
|
|
|
* Caching model when updating and |
42
|
|
|
* delete cache when delete models |
43
|
|
|
* |
44
|
|
|
* @return void |
45
|
|
|
*/ |
46
|
|
|
protected static function boot() |
47
|
|
|
{ |
48
|
|
|
parent::boot(); // TODO: Change the autogenerated stub |
49
|
|
|
static::updating(function ($instance) { |
50
|
|
|
Cache::put('timezones.'.$instance->slug, $instance); |
51
|
|
|
}); |
52
|
|
|
static::deleting(function ($instance) { |
53
|
|
|
Cache::delete('timezones.'.$instance->slug); |
54
|
|
|
}); |
55
|
|
|
} |
56
|
|
|
} |
57
|
|
|
|