arispati/lapice

Laravel library to use repository and service pattern

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

This package is auto-updated.

Last update: 2024-04-24 09:41:50 UTC


README

Laravel library to use repository and service pattern

Table of Contents

Requirement

  • PHP >= 7.1
  • Laravel >= 5.6

Installation

  • Install with composer
composer require arispati/lapice

Available Commands

Create Repository

php artisan lapice:repository ExampleRepository

It will generate app/Repositories/ExampleRepository.php file

<?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;
    }
}

Create Service

php artisan lapice:service ExampleService

It will generate app/Services/ExampleService.php file

<?php

namespace App\Services;

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

Wiki