İlk temizlik tamamlandı bir önceki projeden
This commit is contained in:
@@ -0,0 +1,28 @@
|
||||
<?php
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
function table_columns($tableName) {
|
||||
$prefix = 'table_columns_' . $tableName;
|
||||
if(Cache::has($prefix)) {
|
||||
$columnNames = Cache::get($prefix);
|
||||
} else {
|
||||
$exceptsColumns = ['created_at', 'updated_at'];
|
||||
$columnNames = array_diff(Schema::getColumnListing($tableName), $exceptsColumns);
|
||||
Cache::put($prefix, $columnNames);
|
||||
}
|
||||
|
||||
return $columnNames;
|
||||
}
|
||||
|
||||
function table_column_type($tableName, $columnName) {
|
||||
$prefix = 'table_column_type_' . $tableName . $columnName;
|
||||
|
||||
if(Cache::has($prefix)) {
|
||||
$columnType = Cache::get($prefix);
|
||||
} else {
|
||||
$columnType = Schema::getColumnType($tableName, $columnName);
|
||||
Cache::put($prefix, $columnType);
|
||||
}
|
||||
return $columnType;
|
||||
}
|
||||
|
||||
?>
|
||||
Reference in New Issue
Block a user