Invoice rendering for service, and unit testing for Invoice Item quantity
This commit is contained in:
@@ -4,6 +4,7 @@ namespace App\Models;
|
||||
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
use Illuminate\Support\Arr;
|
||||
use Leenooks\Carbon;
|
||||
|
||||
class InvoiceItem extends Model
|
||||
{
|
||||
@@ -36,6 +37,36 @@ class InvoiceItem extends Model
|
||||
|
||||
/** ATTRIBUTES **/
|
||||
|
||||
/**
|
||||
* Start date for the invoice item line
|
||||
*
|
||||
* We need cast this value to a Leenooks\Carbon for access to startOfHalf() endOfHalf() methods
|
||||
*
|
||||
* @param $value
|
||||
* @return Carbon
|
||||
* @throws \Exception
|
||||
*/
|
||||
public function getDateStartAttribute($value)
|
||||
{
|
||||
if (! is_null($value))
|
||||
return Carbon::createFromTimestamp($value);
|
||||
}
|
||||
|
||||
/**
|
||||
* End date for the invoice item line
|
||||
*
|
||||
* We need cast this value to a Leenooks\Carbon for access to startOfHalf() endOfHalf() methods
|
||||
*
|
||||
* @param $value
|
||||
* @return Carbon
|
||||
* @throws \Exception
|
||||
*/
|
||||
public function getDateStopAttribute($value)
|
||||
{
|
||||
if (! is_null($value))
|
||||
return Carbon::createFromTimestamp($value);
|
||||
}
|
||||
|
||||
public function getItemTypeNameAttribute()
|
||||
{
|
||||
$types = [
|
||||
|
Reference in New Issue
Block a user