定制 martinbean/eloquent-singular-table-names 二次开发

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

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

martinbean/eloquent-singular-table-names

最新稳定版本:v1.0.2

Composer 安装命令:

composer require martinbean/eloquent-singular-table-names

包简介

Makes Eloquent models use singular (rather than plural) table names by default.

README 文档

README

Makes Eloquent models use singular (rather than plural) table names by default.

Usage

Simple apply the trait to your Eloquent model:

namespace App;

use Illuminate\Database\Eloquent\Model;
use MartinBean\Database\Eloquent\SingularTableName;

class User extends Model
{
    use SingularTableName;
}

The default table name will be user now, rather than users.

If you wish to use singular table names for all of your models, then you can create an abstract class that implements the trait, and have all of your models extend that class:

namespace App;

use Illuminate\Database\Eloquent\Model;
use MartinBean\Database\Eloquent\SingularTableName;

abstract class SingularModel extends Model
{
    use SingularTableName;
}
namespace App;

class User extends SingularModel
{
    // No need to implement trait
}

统计信息

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

GitHub 信息

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

其他信息

  • 授权协议: MIT
  • 更新时间: 2015-08-26