Skip to content

Commit 146a91a

Browse files
committed
Added setAllTablesFromDatabase function to base helper
1 parent 8837d0e commit 146a91a

File tree

1 file changed

+19
-1
lines changed

1 file changed

+19
-1
lines changed

src/Classes/BaseHelper.php

Lines changed: 19 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -162,6 +162,22 @@ public function setTables($tables)
162162
return $this;
163163
}
164164

165+
/**
166+
* @return BaseHelper
167+
*/
168+
public function setAllTablesFromDatabase()
169+
{
170+
$columnName = 'Tables_in_'.env('DB_DATABASE');
171+
172+
$this->loopThrough(
173+
$this->getAllTablesFromDatabase()->getSavedItems(),
174+
function ($key, $item) use ($columnName) {
175+
$this->setTables($item->$columnName);
176+
});
177+
178+
return $this;
179+
}
180+
165181
/**
166182
* @return string
167183
*/
@@ -354,7 +370,7 @@ public function executeAll($callback = null)
354370
public function executeWithoutPrepare()
355371
{
356372
try {
357-
$this->executeAll(function (){
373+
$this->executeAll(function () {
358374
DB::unprepared($this->getQuery());
359375
});
360376

@@ -456,5 +472,7 @@ public function done()
456472
public function getAllTablesFromDatabase()
457473
{
458474
$this->setSavedItems(DB::select('SHOW TABLES'));
475+
476+
return $this;
459477
}
460478
}

0 commit comments

Comments
 (0)