此包已被废弃,不再维护。没有建议的替代包。
此包的最新版本(0.0.1)没有可用的许可证信息。

Foodsharing Laravel项目的数据存储库

0.0.1 2017-06-17 11:29 UTC

This package is not auto-updated.

Last update: 2020-01-24 16:52:18 UTC


README

本仓库将保存Foodsharing的整个Datalogic作为Laravel包。

  • Foodsaver
  • 商店
  • 团队...
  • ...

安装

  1. 进入你的Foodsharing Laravel项目,并添加以下composer包依赖
$ composer require foodsharing/data "dev-master"
  1. 在"config/app.php"中注册Laravel服务提供者。
    'providers' => [
    // ...
    Foodsharing\Data\DataServiceProvider::class,
    // ...
  1. 准备好了!要了解更多,请阅读Laravel 文档

使用存储库

要在Laravel控制器中使用存储库,你需要在构造函数中添加一个实例,例如。

...

class StoreController extends Controller
{
    private $repo_store;

    public function __construct(StoreRepo $store_repo) {
        $this->repo_store = $store_repo;
    }

    public function profile() {

        $store = $this->repo_store->find(123);
        
        return view('store',[
		'store' => $store
	]);

    }
}