定制 jarrodtomholt/belongs-to-macro 二次开发

按需修改功能、优化性能、对接业务系统,提供一站式技术支持

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

jarrodtomholt/belongs-to-macro

最新稳定版本:1.0.0

Composer 安装命令:

composer require jarrodtomholt/belongs-to-macro

包简介

Automatically add index and constraints to your migration foreignIdFor entities with a simple macro

README 文档

README

Automatically add index and foreign key constraints to your migrations enforcing data integrity, preserving the referential association and improving query performance.

Installation

You can install the package via composer:

composer require jarrodtomholt/belongs-to-macro

Usage

In a migrations up() method, use the following in place of foreignIdFor to add indexes and foreign key constraints.

Schema::create('posts', function (Blueprint $table) {
    $table->belongsTo(User::class);
});

// will expand to
$table->foreignIdFor(User::class)->index()->constrained();

Need a nullable field? use belongsToOrNull

Schema::create('posts', function (Blueprint $table) {
    $table->belongsToOrNull(User::class);
});

// will expand to
$table->foreignIdFor(User::class)->nullable()->index()->constrained();

Testing

composer test

Contributing

Please see CONTRIBUTING for details.

Security

If you discover any security related issues, please raise an issue using the issue tracker.

License

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

Laravel Package Boilerplate

This package was generated using the Laravel Package Boilerplate.

统计信息

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

GitHub 信息

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

其他信息

  • 授权协议: MIT
  • 更新时间: 2023-01-24

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固