I'm new to laravel
I have post
table, this table has 10 columns.
So i want to get all column names in model Laravel Does this feature already work??
Or do I have to make it myself ??
Any suggestion or advice would be appreciated.
Thank you in advance
You can use the getColumnListing()
method:
use Schema;
Schema::getColumnListing($this->getTable())
$columns = Schema::getColumnListing('posts');
dd($columns);
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With