thibaultvanc/facturation-regie

此包允许您管理您的账单

1.0.1 2019-04-15 10:38 UTC

This package is auto-updated.

Last update: 2024-09-15 22:23:27 UTC


README

Latest Version on Packagist Build Status Quality Score Total Downloads

这里应该放置您的描述。尽量限制在一两段话内,并可能提及您支持的PSRs,以避免用户和贡献者产生混淆。

安装

您可以通过composer安装此包

composer require thibaultvanc/facturation-regie

用法

1-编辑配置

要使用此包,您需要

  • 用户模型
  • 项目模型
  • 可点模型(任务 & 会议)
  • 账单(计划)

需要将您的模型与特性关联

用户 => FacturationRegie\Traits\RegieInvoicable\RegieUser 账单 => FacturationRegie\Traits\RegieInvoicable\RegieInvoice

点数 => FacturationRegie\Traits\RegieInvoicable\RegiePointage
项目 => FacturationRegie\Traits\RegieInvoicable\RegieProject 任务/会议 => FacturationRegie\Traits\RegieInvoicable

例子 => 在Task / Meeting / Deplacement等表上添加RegieInvoicable特性

class Task extends Model
{
    use \FacturationRegie\Traits\RegieInvoicable
}

默认外键用于确定负责人是 "responsable_id"。注意:覆盖设置不同键的方法

public function regie_responsable()
    {
        return $this->belongsTo(\App\User::class, 'user_id');
    }

##转换可点对象(任务 / 任务状态 / 会议)

#调整日期

覆盖getPointageDate()方法。返回一个Carbon实例。如果此方法不存在,则取当前时间

public function getPointageDate() :Carbon
    {
        return $this->done_at
    }

#调整名称

覆盖getPointageName()方法。返回一个Carbon实例。如果此方法不存在,则取当前时间

public function getPointageName() :Carbon
    {
        return $this->task_title
    }

#调整日期

覆盖getPointageDescription()方法。返回一个Carbon实例。如果此方法不存在,则取当前时间

public function getPointageDescription() :Carbon
    {
        return $this->body
    }

点数作用域

Pointage::between($date1, $date2); (carbon date or string)

Pointage::forDay($date); (carbon date or carbon)
Pointage::forMonth($date);  (prend le mois en cours)
Pointage::forYeay('2019');  (carbon)
Pointage::forUser($user); (user object or user_id)

Pointage::facturable();
Pointage::noFacturable();

您可以组合如下

    Pointage::forProject($project)
            ->forMonth(now())
            ->forUser($user)
            ->facturable();

附加

您可以按项目作用域

Pointage::forProject($project);

要这样做,您需要

  • 在项目模型上添加方法 ... ----------WIP--------