hskyzhou/repository

Laravel 5, Service - business logic, Presenter - preview deal view, Repository - database layer

1.0.2 2017-06-02 07:33 UTC

This package is auto-updated.

Last update: 2024-11-29 05:26:39 UTC


README

Laravel5 Repository include Service, Presenter and Repository. Repository is used to abstract the data layer, making application more flexible. Service is used to deal business logic. Presenter is used to deal View page.

Table of Contents

Install

Composer

	composer require hskyzhou/repository

Laravel

edit config.php

'providers' => [
    ...
    HskyZhou\Repository\ServiceProvider::class,
],

如果需要使用接口,则在使用命令之后,在如上的数组中添加

'providers' => [
    ...
	App\Providers\RepositoryServiceProvider::class,
],

Publish Configuration

php artisan vendor:publish --tag=config --provider "HskyZhou\Repository\ServiceProvider"

Command

创建实例

php artisan make:entity Test

以上命令创建

  1. migration
  2. model
  3. repositoryInterface
  4. repositoryEloquent
  5. service 业务逻辑
  6. presenter 页面预处理
  7. process(可选--命令会提示是否创建) 数据处理层

####创建数据处理层

php artisan make:process Test

####创建业务逻辑

php artisan make:service Test

####创建页面预处理

php artisan make:presenter Test