2017-01-30 20:40:43 +01:00
|
|
|
<?php
|
|
|
|
|
|
|
|
namespace App\Models;
|
2015-03-16 22:45:25 +01:00
|
|
|
|
2015-03-25 20:56:31 +01:00
|
|
|
use Eloquent;
|
2017-12-07 11:33:46 +01:00
|
|
|
use Str;
|
2015-03-25 20:56:31 +01:00
|
|
|
|
2016-07-03 18:11:58 +02:00
|
|
|
/**
|
2017-01-30 20:40:43 +01:00
|
|
|
* Class InvoiceStatus.
|
2016-07-03 18:11:58 +02:00
|
|
|
*/
|
2015-03-16 22:45:25 +01:00
|
|
|
class InvoiceStatus extends Eloquent
|
|
|
|
{
|
2016-07-03 18:11:58 +02:00
|
|
|
/**
|
|
|
|
* @var bool
|
|
|
|
*/
|
2015-03-16 22:45:25 +01:00
|
|
|
public $timestamps = false;
|
2017-04-05 21:20:11 +02:00
|
|
|
|
|
|
|
public static function getIdFromAlias($status)
|
|
|
|
{
|
|
|
|
switch ($status) {
|
|
|
|
case 'draft':
|
|
|
|
return INVOICE_STATUS_DRAFT;
|
|
|
|
case 'sent':
|
|
|
|
return INVOICE_STATUS_SENT;
|
|
|
|
case 'viewed':
|
|
|
|
return INVOICE_STATUS_VIEWED;
|
|
|
|
case 'approved':
|
|
|
|
return INVOICE_STATUS_APPROVED;
|
|
|
|
case 'partial':
|
|
|
|
return INVOICE_STATUS_PARTIAL;
|
|
|
|
case 'overdue':
|
|
|
|
return INVOICE_STATUS_OVERDUE;
|
|
|
|
case 'unpaid':
|
|
|
|
return INVOICE_STATUS_UNPAID;
|
|
|
|
default:
|
|
|
|
return false;
|
2017-12-07 11:33:46 +01:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* @return mixed
|
|
|
|
*/
|
|
|
|
public function getTranslatedName()
|
|
|
|
{
|
|
|
|
return trans('texts.status_' . Str::slug($this->name, '_'));
|
2017-04-05 21:20:11 +02:00
|
|
|
}
|
2015-03-16 22:45:25 +01:00
|
|
|
}
|