forked from ProcessMaker/processmaker
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathCachedSchema.php
More file actions
33 lines (26 loc) · 792 Bytes
/
CachedSchema.php
File metadata and controls
33 lines (26 loc) · 792 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
<?php
namespace ProcessMaker\Helpers;
use Illuminate\Support\Facades\Cache;
use Illuminate\Support\Facades\Schema;
class CachedSchema
{
const CACHE_TAG = 'schema';
public function hasTable(string $table) : bool
{
$key = 'hasTable_' . $table;
return Cache::tags(self::CACHE_TAG)->rememberForever(
$key, function () use ($table) {
return Schema::hasTable($table);
}
);
}
public function hasColumn(string $table, string $column) : bool
{
$key = 'hasColumn_' . $table . '_' . $column;
return Cache::tags(self::CACHE_TAG)->rememberForever(
$key, function () use ($table, $column) {
return Schema::hasColumn($table, $column);
}
);
}
}