This extension can query your database tables and insert the relevant eloquent model attributes such as $fillable, $casts, etc.
Use the Command Palette to excute "Insert Eloquent Model Attributes" in your model file. The extension will automatically get your database information and asks you to input the table name.
You can use the "Insert PHPDoc for Eloquent Model Attributes" command to insert PHPDoc for the model.
This extension can detect and insert following attribute changes. You can change these in the extension settings.
- Different primary key name other than
id
. - Checks if the auto increment is turned off.
- Checks if the primary is a UUID and adds
HasUuids
trait.
- If the table is using soft deletes,
SoftDeletes
trait will be added.
- The primary key will be ignored.
- The foreign keys will be ignored.
- Auto incrementing columns will be ignored.
- Any columns with the text
password
,token
, oradmin
in the name will be ignored. - Any columns ending in
_at
will be ignored. - Any columns starting with
is_
will be ignored. - Everything else is addeed to the
$fillable
array.
created_at
,updated_at
anddeleted_at
are not casted.timestamp
is casted todatetime
.tinyint
is casted toboolean
.json
is casted toarray
.
- Only supports MySQL at the moment.
Fixed issue in windows
New command for PHPDoc generation.
- Extracts the model name and converts it into the table name according to Laravel standards. This table name is used as a default in the user input.
- Maintains proper code indentation while adding new code.
Configuration options.
Initial release of Laravel Eloquent Model Attributes.