1
0
mirror of https://github.com/invoiceninja/invoiceninja.git synced 2024-11-10 13:12:50 +01:00
invoiceninja/app/Transformers/ExpenseCategoryTransformer.php
Benjamin Beganović ae88d5e08e php-cs-fixer format
2020-11-25 15:19:52 +01:00

54 lines
1.3 KiB
PHP

<?php
/**
* Invoice Ninja (https://invoiceninja.com).
*
* @link https://github.com/invoiceninja/invoiceninja source repository
*
* @copyright Copyright (c) 2020. Invoice Ninja LLC (https://invoiceninja.com)
*
* @license https://opensource.org/licenses/AAL
*/
namespace App\Transformers;
use App\Models\ExpenseCategory;
use App\Utils\Traits\MakesHash;
use Illuminate\Database\Eloquent\SoftDeletes;
/**
* class ExpenseCategoryTransformer.
*/
class ExpenseCategoryTransformer extends EntityTransformer
{
use MakesHash;
use SoftDeletes;
protected $defaultIncludes = [
];
/**
* @var array
*/
protected $availableIncludes = [
];
/**
* @param ExpenseCategory $expense_category
*
* @return array
*/
public function transform(ExpenseCategory $expense_category)
{
return [
'id' => $this->encodePrimaryKey($expense_category->id),
'user_id' => $this->encodePrimaryKey($expense_category->user_id),
'name' => (string) $expense_category->name ?: '',
'is_deleted' => (bool) $expense_category->is_deleted,
'updated_at' => (int) $expense_category->updated_at,
'archived_at' => (int) $expense_category->deleted_at,
'created_at' => (int) $expense_category->created_at,
];
}
}