Skip to content

It does not have the feature of working with multiple databases #12

@hectorRNS

Description

@hectorRNS

For example, I launched php artisan crud:generate clickApp.agents and it created a file with the same name but I named the fields correctly in the database.

It would be good to add a new parameter to take into account here only:

private function _getTableRelations()
{
$db = DB::getDatabaseName();
$sql = <<<SQL
SELECT TABLE_NAME ref_table, COLUMN_NAME foreign_key, REFERENCED_COLUMN_NAME local_key, '1' ref
FROM INFORMATION_SCHEMA.KEY_COLUMN_USAGE
WHERE REFERENCED_TABLE_NAME = '$this->table' AND TABLE_SCHEMA = '$db'
UNION
SELECT REFERENCED_TABLE_NAME ref_table, REFERENCED_COLUMN_NAME foreign_key, COLUMN_NAME local_key, '0' ref
FROM INFORMATION_SCHEMA.KEY_COLUMN_USAGE
WHERE TABLE_NAME = '$this->table' AND TABLE_SCHEMA = '$db' AND REFERENCED_TABLE_NAME IS NOT NULL

ORDER BY ref_table ASC
SQL;

    return DB::select($sql);
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions