commsexpress/smart-entities

该包的最新版本(dev-relation_and_timestamp_bugfixes)没有提供许可信息。

使用智能实体模式扩展Laravel的微框架

dev-relation_and_timestamp_bugfixes 2018-03-12 10:37 UTC

This package is auto-updated.

Last update: 2024-09-13 02:49:58 UTC


README

创建实体

  • 从命令行运行php artisan make:smart {name}
  • 命令接受一个可选的第二个参数,用于实体的{domain}。域名将确定仓库文件结构(同一域名内的仓库被分组)和默认服务。默认为{name}参数。
  • 命令接受以下选项
    • -c--controller
    • -r--resource用于资源控制器
    • -s--service
    • -m--migration

删除实体

  • 从命令行运行php artisan del:smart {name}
  • 命令接受一个可选的第二个参数,用于实体的{domain}
  • 如果需要删除域名的仓库文件夹(以及其中所有内容),请接受-f--force选项

创建用户实体

  • 从命令行运行php artisan make:smartauth
  • 将以下内容添加到App\Providers\AuthServiceProvider的boot函数中,在下面的`$this->registerPolicies()`之后:`Auth::provider('smartprovider', function() {

       return new SmartAuthProvider($this->app['hash'],
        app()->make(\App\Services\UserService::class));
    

    });`

  • 在config/auth中:1) 将guards.web.provider更改为'smart' 2) 添加以下到providers数组中:`'smart' => [

      'driver' => 'smartprovider',
      'model' => App\Entities\UserEntity::class,
    

    ]`

TODO

  • 是否将withTrashed作为全局范围进行检查?
  • 将填充属性放在实体上
  • 替换App引用为DummyRootNamespace