tharindu/service-maker 问题修复 & 功能扩展

解决BUG、新增功能、兼容多环境部署,快速响应你的开发需求

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

tharindu/service-maker

最新稳定版本:v1.0.0

Composer 安装命令:

composer require tharindu/service-maker

包简介

A Laravel package to generate service files via Artisan command.

README 文档

README

tharindu/service-maker is a Composer package for Laravel that provides an Artisan command to generate service files. This package simplifies the process of creating service classes tailored to your Laravel application's needs.

Installation

You can install the package via Composer:

composer require tharindu/service-maker

Usage

To generate a service file, use the Artisan command:

php artisan make:service

Follow the prompts to specify whether to create a folder for the service, the folder name, model name related to the service, and the service name itself. The command will create the necessary service file in your Laravel application's app/Services directory.

Example

Here's an example of how the generated service file looks:

<?php

namespace App\Services\Product;

use App\Models\Product;

class ProductService
{
    protected $product;

    public function __construct(Product $product)
    {
        $this->product = $product;
    }

    // Example methods:
    public function store($data)
    {
        return $this->product->create($data);
    }

    public function update($data, $id)
    {
        return $this->product->where('id', $id)->update($data);
    }

    public function destroy($id)
    {
        return $this->product->destroy($id);
    }

    public function show($id)
    {
        return $this->product->find($id);
    }

    public function all()
    {
        return $this->product->all();
    }
}

Replace ProductService, Product, and methods as per your application's requirements.

License

This package is open-sourced software licensed under the MIT license.

Contributing

Contributions are welcome! Feel free to submit issues and pull requests.

Author

Acknowledgements

Thank you to the Laravel community and contributors."

统计信息

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

GitHub 信息

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

其他信息

  • 授权协议: MIT
  • 更新时间: 2024-07-08