vdauchy/laravel-model-injector 问题修复 & 功能扩展

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

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

vdauchy/laravel-model-injector

Composer 安装命令:

composer require vdauchy/laravel-model-injector

包简介

README 文档

README

Laravel Model Injector

This package is a simple trait to help on Model Injection.

The main goal is to replace class set in config as in laravel-permission:

// In: config/permission.php
return [
    'models' => [
        'permission' => Permission::class,
        'role' => Role::class,
    ],
    ...
];

// In: src/PermissionRegistrar.php
public function __construct(CacheManager $cacheManager)
{
    $this->permissionClass = config('permission.models.permission');
    $this->roleClass = config('permission.models.role');
    ...
}

And instead do:

// In: src/PermissionRegistrar.php

use HasModelInjection;

public function __construct(CacheManager $cacheManager)
{
    $this->permissionClass = $this->mClass(Permission::class);
    $this->roleClass = $this->mClass(Role::class);
    ...
}

To use their own class, any developer can do:

$this->app->bind(Permission::class, MyCustomPermission::class);

Current API:

mQuery(string $model): Builder: Let you build a query against this Model.

mNew(string $model, array $attributes = []): Model: Let you create a new instance of this Model.

mClass(string $model): string: Return the class associated to the Model.

mTable(string $model): string: Return the table's name of the Model".

mColumns(string $model): Collection: Return a Collection of columns.

统计信息

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

GitHub 信息

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

其他信息

  • 授权协议: MIT
  • 更新时间: 2021-01-28

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固