Skip to content

Commit

Permalink
Merge pull request #13 from Lakshan-Madushanka/master
Browse files Browse the repository at this point in the history
Fix tomato:generate command not working with sqlite and some other DBs.
  • Loading branch information
3x1io authored Jun 3, 2024
2 parents 054d917 + 7551a57 commit 4ecec36
Showing 1 changed file with 3 additions and 5 deletions.
8 changes: 3 additions & 5 deletions src/Console/TomatoGenerator.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
namespace TomatoPHP\TomatoPHP\Console;

use Doctrine\DBAL\Schema\Schema;
use Illuminate\Database\Schema\Builder;
use Illuminate\Console\Command;
use Illuminate\Support\Str;
use Nwidart\Modules\Facades\Module;
Expand Down Expand Up @@ -42,12 +43,9 @@ class TomatoGenerator extends Command
/**
* @return void
*/
public function handle(): void
public function handle(Builder $schema): void
{

$tables = collect(\DB::select('SHOW TABLES'))->map(function ($item){
return $item->{'Tables_in_'.config('database.connections.mysql.database')};
})->toArray();
$tables = $schema->getTableListing();

$tableName = $this->argument('table') && $this->argument('table') != "0" ? $this->argument('table') : search(
label: 'Please input your table name you went to create CRUD?',
Expand Down

0 comments on commit 4ecec36

Please sign in to comment.