leo-yi/laravel-fillable

A Laravel package that generates php array keys from table fields

v2.2.2 2022-03-25 02:55 UTC

This package is auto-updated.

Last update: 2025-06-25 09:36:39 UTC


README

中文文档

Installation

laravel framework require

  • leo-yi/laravel-fillable:^2.0 -> Laravel >= 7.0
  • leo-yi/laravel-fillable:^1.0 -> Laravel ^6.0

You can install the package via composer:

Laravel >= 7.0 :

composer require leo-yi/laravel-fillable --dev

Laravel ^6.0 :

composer require leo-yi/laravel-fillable:1.5 --dev

You can publish the config file with:

php artisan vendor:publish --provider="Leoyi\LaravelFillable\LaravelFillableServiceProvider" --tag="laravel-fillable"

Usage

Default model: only columns

php artisan fillable table_name
'id',
'title',
'age',
'created_at',

First model: columns with table comment

php artisan fillable table_name 1
'id' => 'ID',
'name' => '名称',
'age' => '年龄',
'created_at' => '',

Second model: table comment for array key comment

php artisan fillable table_name 2
'id' => '', // ID
'name' => '', // 名称
'age' => '', // 年龄
'created_at' => '', // 创建时间

Third model: Generates an array of key-value pairs, excluding comments

php artisan fillable table_name 3
'id' => $this->id,
'name' => $this->name,
'age' => $this->age,
'created_at' => $this->created_at,

Third model: Generates an array of key-value pairs, including comments

php artisan fillable table_name 4
'id' => $this->id, // ID
'name' => $this->name, // 名称
'age' => $this->age, // 年龄
'created_at' => $this->created_at, // 创建时间

Fourth mode: model comment for phpstorm

php artisan fillable table_name 5
* @property bigint $id // Id
* @property string $name // 姓名
* @property int $age // 年龄

Changelog

Please see CHANGELOG for more information on what has changed recently.

License

The MIT License (MIT). Please see License File for more information.