Add tinker files

This commit is contained in:
Afiq Hamzah
2023-11-23 16:39:50 +08:00
parent b784408a59
commit 8c09f6f64d
4 changed files with 293 additions and 0 deletions
+26
View File
@@ -0,0 +1,26 @@
<?php
use Illuminate\Support\Facades\DB;
$all_active_db_keys = array_filter(array_keys(config('database.connections')), function ($connection) {
try {
DB::connection($connection)->getPdo();
return true;
} catch (\Throwable $th) {
return false;
}
});
$non_cawangan_database = ['lelong', 'online_arrahn', 'kaunterpkb'];
$all_cawangan_db = array_filter($all_active_db_keys, function($db_key) use($non_cawangan_database){
$isNotCawangan = in_array(config('database.connections.' . $db_key . '.database'), $non_cawangan_database);
if($isNotCawangan){
return false;
}
return true;
});
return $all_cawangan_db;