yassinya/laravel-relation-cli 问题修复 & 功能扩展

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

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

yassinya/laravel-relation-cli

Composer 安装命令:

composer require yassinya/laravel-relation-cli

包简介

Quickly define relationships between eloquent models with a simple command

README 文档

README

This package allows you to define relationships between your models directly from the command line instead of creating them then setting the relationship methods manually.

Most of the Laravel relationships are supported, including polymorphic ones.

Installation

This package can be installed via composer:

composer require yassinya/laravel-relation-cli

The service provider will be automatically registered

Publish the config file with:

php artisan vendor:publish --provider="Yassinya\Relation\RelationServiceProvider" --tag="config"

Usage

To define a relationship you'll need to use the relation command which expects 3 required arguments:

  1. The main model's name
  2. The type of the relationship

The following abbreviations are used for the relationships

  • One To One -> 121
  • One to Many -> 12m
  • Many to Many -> m2m
  1. Name of the target model

One to One

php artisan relation User 121 Phone

It'll first try to find The models then edit them, and if they don't exist they'll be created

One to Many

php artisan relation Library 12m Book

Many to Many

php artisan relation User m2m Product

Polymorphic Relationships

To define a polymorphic relationship just add the -p or --polymorphic option. For instance to define a 121 polymorphic relationship between Post and Image

php artisan relation Post 121 Image -p

Between User and Image

php artisan relation User 121 Image -p

统计信息

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

GitHub 信息

  • Stars: 7
  • Watchers: 1
  • Forks: 3
  • 开发语言: PHP

其他信息

  • 授权协议: mit
  • 更新时间: 2020-06-19

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固