Skip to content

Instantly share code, notes, and snippets.

@fridzema
Created February 27, 2020 14:59
Show Gist options
  • Save fridzema/0bb76179a155024b6939613dd028499e to your computer and use it in GitHub Desktop.
Save fridzema/0bb76179a155024b6939613dd028499e to your computer and use it in GitHub Desktop.
$tables = collect(Schema::getAllTables())->pluck('Tables_in_pmp');
$softdeletes = [];
foreach ($tables as $table) {
if (Schema::hasColumn($table, 'deleted_at')) {
$softdeletes[$table] = DB::table($table)->whereNotNull('deleted_at')->count();
}
}
$softdeletes = collect($softdeletes)->filter(function ($value, $key) {
return $value > 0;
});
dd($softdeletes);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment