aidias/gelb-repository

Laravel应用程序的仓库结构

安装: 910

依赖项: 0

建议者: 0

安全: 0

星星: 2

关注者: 2

分支: 1

开放问题: 0

类型:

dev-master 2020-10-30 12:14 UTC

This package is auto-updated.

Last update: 2024-09-29 05:02:41 UTC


README

Laravel应用程序的仓库结构。

入门指南

以下说明将帮助您获取并运行项目副本。

先决条件

  • Laravel >= 5.8
  • PHP >= 7.2

安装

  1. 您需要 composer 和一个 Laravel 项目在您的开发环境中设置。然后,在终端中运行以下命令
composer require aidias/gelb-repository
  1. 包安装后,运行
php artisan gelb:repository:init

这将在您的Laravel应用程序中创建以下GelbRepository结构

  • app\Providers\RepositoryServiceProvider.php:这是仓库注入的服务提供者。
  • app\Repositories:它将包含所有相关仓库的文件;
  • app\Repositories\Interfaces\AbstractInterface.php:此接口将为其他仓库实现提供公共基本规则;
  • app\Repositories\Eloquent\AbstractEloquent.php:这是对AbstractInterface.php的Eloquent实现。您可以使用其他框架通过使用此指南
  1. config\app.phpproviders 数组中注册 RepositoryServiceProvider
	'providers' => [
		...
		App\Providers\RepositoryServiceProvider::class,
		...
	],

用法

  1. 例如,要创建一个 Post 仓库,运行
php artisan gelb:make:repository Post

这将会创建以下文件(如果它们不存在的话)

  • app\Http\Controllers\PostController.php
  • app\Http\Requests\PostStoreRequest.php
  • app\Http\Requests\PostUpdateRequest.php
  • app\Repositories\Eloquent\PostEloquent.php
  • app\Repositories\Interfaces\PostInterface.php
  • app\Post.php

作者

  • Rafael Casachi - 初始工作 - 网站
  • Cristiano Fromagio - 贡献者 - GitHub
  • Leandro Cuminato - 贡献者 - GitHub

许可

本项目采用MIT许可 - 有关详细信息,请参阅LICENSE.md 文件。