hskyzhou / repository by xezw211

Laravel 5, Service - business logic, Presenter - preview deal view, Repository - database layer
14
1
2
Package Data
Maintainer Username: xezw211
Maintainer Contact: xezw211@126.com (hsky)
Package Create Date: 2017-06-02
Package Last Update: 2017-06-02
Language: PHP
License: MIT
Last Refreshed: 2024-04-30 15:15:34
Package Statistics
Total Downloads: 14
Monthly Downloads: 0
Daily Downloads: 0
Total Stars: 1
Total Watchers: 2
Total Forks: 0
Total Open Issues: 0

Laravel 5 Repository

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
    • Laravel
  • Command

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