定制 taylornetwork/laravel-repository 二次开发

按需修改功能、优化性能、对接业务系统,提供一站式技术支持

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

taylornetwork/laravel-repository

Composer 安装命令:

composer require taylornetwork/laravel-repository

包简介

A repository service provider to dynamically bind all existing repositories in app.

README 文档

README

An easy and customizable to create repositories that will be automatically registered for you.

Install

Via Composer

$ composer require taylornetwork/laravel-repository

Setup

Add the service provider to the providers array in config/app.php

'providers' => [
	
	TaylorNetwork\LaravelRepository\RepositoryServiceProvider::class,
	
],

Publish Config

$ php artisan vendor:publish

Will add repository.php to your config directory.

Usage

The service provider will automatically bind repositories to their contracts based on the settings in config/repository.php

Defaults

By default Repositories are stored in App\Repositories\ModelName where ModelName is the name of the model the repository will handle.

The default naming convention used is ModelNameRepository for the contract and EloquentModelName for the class.

Commands

make:repository

This package adds the artisan command repository:generate to create the repository pattern based on settings in config/repository.php

To create a repository for the User model

$ php artisan repository:generate User

Will create

- ProjectRoot
	- app
		- Repositories
			- User
				- UserRepository.php
				- EloquentUser.php

If you are using a driver other than Eloquent you can specify using the --driver option

$ php artisan repository:generate User --driver=storage

Will create

- ProjectRoot
	- app
		- Repositories
			- User
				- UserRepository.php
				- StorageUser.php

Note: If you plan on using other drivers add them to the drivers array in config/repository.php, the service provider will search for the class in the order of the array.

make:repositoryClass

Same as repository:generate but will only create the class, no contract.

$ php artisan repository:class User --driver=storage

Creates app/Repositories/User/StorageUser.php

make:repositoryContract

Same as repository:generate but will only create the contract, no class.

$ php artisan repository:contract User 

Creates app/Repositories/User/UserRepository.php

Note: This command does not accept the --driver option.

Credits

License

The MIT License (MIT). Please see License File for more information.

统计信息

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

GitHub 信息

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

其他信息

  • 授权协议: Unknown
  • 更新时间: 2016-11-22

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固