cardosso4/generate-model 问题修复 & 功能扩展

解决BUG、新增功能、兼容多环境部署,快速响应你的开发需求

邮箱:yvsm@zunyunkeji.com | QQ:316430983 | 微信:yvsm316

cardosso4/generate-model

最新稳定版本:v0.0.5

Composer 安装命令:

composer require cardosso4/generate-model

包简介

Model generator for the laravel framework

README 文档

README

Laravel Logo

This library aims to facilitate the creation of the model file with the necessary data as shown in the example below.

This library supports the databases.

  • Mysql

How to execute:

  • To run this command, run in the terminal: php artisan generate:model {table_name}
  • This command can be found in PHP artisan command list

Example of the result

<?php

namespace App\Models;

use Illuminate\Database\Eloquent\Factories\HasFactory;
use Illuminate\Database\Eloquent\Model;

class users extends Model
{

	public const FIELD_ID = 'id';
	public const FIELD_NAME = 'name';
	public const FIELD_ADDRESS_ID = 'address_id';


	protected $fillable = [
		self::FIELD_ID,
		self::FIELD_NAME,
		self::FIELD_ADDRESS_ID,
	];

	protected $casts = [
		self::FIELD_ID => 'bigint',
		self::FIELD_NAME => 'string',
		self::FIELD_ADDRESS_ID  => 'bigint',
	];


	/**
	* Relationships
	*/

	public function address(){
		$this->belongsTo(Address::class, 'address_id', 'id');
	}

}

Package for installation

generate-model: Packagist

统计信息

  • 总下载量: 747
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 4
  • 点击次数: 2
  • 依赖项目数: 0
  • 推荐数: 0

GitHub 信息

  • Stars: 4
  • Watchers: 1
  • Forks: 0
  • 开发语言: PHP

其他信息

  • 授权协议: MIT
  • 更新时间: 2024-06-02

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固