arispati/lapice

Laravel 库,用于使用仓库和服务模式

v0.1.0 2022-01-24 04:14 UTC

This package is auto-updated.

Last update: 2024-09-24 10:43:40 UTC


README

Laravel 库,用于使用仓库和服务模式

目录

需求

  • PHP >= 7.1
  • Laravel >= 5.6

安装

  • 使用 composer 安装
composer require arispati/lapice

可用命令

创建仓库

php artisan lapice:repository ExampleRepository

它将生成 app/Repositories/ExampleRepository.php 文件

<?php

namespace App\Repositories;

use Arispati\Lapice\Repository\BaseRepository;

class ExampleRepository extends BaseRepository
{
    /**
     * Set the model class
     *
     * @return string
     */
    protected function setModel(): string
    {
        // return Model::class;
    }
}

创建服务

php artisan lapice:service ExampleService

它将生成 app/Services/ExampleService.php 文件

<?php

namespace App\Services;

class ExampleService
{
    /**
     * Class constructor
     */
    public function __construct()
    {
        //
    }
}

维基