Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.

randm's avatar
Level 6

Is there a way to get the column listing with column type using eloquent?

I am trying to get the column listing along with column type, isNullable, default value.

I am aware I can get column listing like so Schema::getColumnListing('posts') but that only gives me the names of the column not the rest of the story.

How can I obtain such info using eloquent?

Is this something possible without having to manually execute a select query againstINFORMATION_SCHEMA.COLUMNS table for every supported database driver?

0 likes
7 replies
randm's avatar
Level 6

@SaeedPrez describe is a MySQL command. I want to be able to do the same thing for all database drives. SqlServer, SqlLite....

TerrePorter's avatar

What about using Schema::getColumnType('table', 'column');

1 like
Jaytee's avatar

Why do you need the command for every driver supported with PDO anyway? What exactly are you building that requires you to switch databases 24/7?

randm's avatar
Level 6

@TerrePorter Schema::getColumnType('posts', 'column') giving me the following error

[Symfony\Component\Debug\Exception\FatalErrorException] Class 'Doctrine\DBAL\Driver\PDOMySql\Driver' not found

@Jaytee I am writing a package that need to get info about the table column. Regardless of that driver that the users is using, I will need that info.

Please or to participate in this conversation.