1
1

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 3 years have passed since last update.

【Laravel】テーブルのカラム名を取得して、配列化するメソッド

Last updated at Posted at 2021-10-08

テーブルのカラム名を取得して、配列化する方法
getColumnListingを使う!

Schemaファサードを使用

use Illuminate\Support\Facades\Schema;

getColumnListingでテーブル名を指定してカラム名取得

getColumnListing('テーブル名');

Tinkerで実行して確認する場合は下記のように記述

Illuminate\Support\Facades\Schema::getColumnListing('テーブル名');
1
1
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
1
1

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?