1
0
mirror of https://github.com/invoiceninja/invoiceninja.git synced 2024-11-14 15:13:29 +01:00
invoiceninja/app/Models/InvoiceStatus.php
2017-12-07 12:33:46 +02:00

48 lines
1016 B
PHP

<?php
namespace App\Models;
use Eloquent;
use Str;
/**
* Class InvoiceStatus.
*/
class InvoiceStatus extends Eloquent
{
/**
* @var bool
*/
public $timestamps = false;
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;
}
}
/**
* @return mixed
*/
public function getTranslatedName()
{
return trans('texts.status_' . Str::slug($this->name, '_'));
}
}