mirror of
https://github.com/snipe/snipe-it.git
synced 2024-11-10 07:34:06 -08:00
61543f3a04
* Add presenters for models. Move bootstrap table JSON generation to these presenters, which cleans up controllers a lot. Move view specific modifications from the models to the presenters as well. * Fix some issues found by travis and codacy * Fix a few more issues found while testing. * Attempt another acceptance test fix * Try something else * Maybe..
39 lines
909 B
PHP
39 lines
909 B
PHP
<?php
|
|
|
|
namespace App\Presenters;
|
|
|
|
|
|
use App\Helpers\Helper;
|
|
|
|
/**
|
|
* Class DepreciationPresenter
|
|
* @package App\Presenters
|
|
*/
|
|
class DepreciationPresenter extends Presenter
|
|
{
|
|
/**
|
|
* Formatted JSON representation of this Depreciation
|
|
* @return array
|
|
*/
|
|
public function forDataTable()
|
|
{
|
|
$actions = Helper::generateDatatableButton('edit', route('depreciations.edit', $this->id));
|
|
$actions .= Helper::generateDatatableButton(
|
|
'delete',
|
|
route('depreciations.destroy', $this->id),
|
|
true, /*enabled*/
|
|
trans('admin/depreciations/message.delete.confirm'),
|
|
$this->name
|
|
);
|
|
|
|
$results = [
|
|
'id' => $this->id,
|
|
'name' => $this->name,
|
|
'months' => $this->months,
|
|
'actions' => $actions
|
|
];
|
|
|
|
return $results;
|
|
}
|
|
}
|