From 8ab29c628f85d9812e139cd77d97c7af2958d19e Mon Sep 17 00:00:00 2001 From: snipe Date: Tue, 23 May 2017 14:31:44 -0700 Subject: [PATCH] Added icon to presenter --- app/Presenters/ActionlogPresenter.php | 51 +++++++++++++++------------ 1 file changed, 29 insertions(+), 22 deletions(-) diff --git a/app/Presenters/ActionlogPresenter.php b/app/Presenters/ActionlogPresenter.php index a5a5035a4..55374e278 100644 --- a/app/Presenters/ActionlogPresenter.php +++ b/app/Presenters/ActionlogPresenter.php @@ -8,25 +8,6 @@ namespace App\Presenters; */ class ActionlogPresenter extends Presenter { - /** - * Link to this companies name - * @return string - */ - public function forDataTable() - { - - return [ - 'icon' => '', - 'created_at' => date("M d, Y g:iA", strtotime($this->created_at)), - 'action_type' => strtolower(trans('general.'.str_replace(' ', '_', $this->action_type))), - 'admin' => $this->admin(), - 'target' => $this->target(), - 'item' => $this->item(), - 'item_type' => $this->itemType(), - 'note' => e($this->note), - - ]; - } public function admin() { @@ -35,9 +16,8 @@ class ActionlogPresenter extends Presenter return $user->present()->nameUrl(); } // The user was deleted - return ''.$user->present()->name()." (deleted)"; + return ''.$user->getFullNameAttribute()." (deleted)"; } - return ''; } @@ -51,11 +31,38 @@ class ActionlogPresenter extends Presenter return $this->model->item->present()->nameUrl(); } // The item was deleted - return ''.$item->present()->name().' (deleted)'; + return ''.$item->name.' (deleted)'; } return ''; } + + public function icon() + { + if ($this->itemType() == "asset") { + $itemicon = 'fa fa-barcode'; + } elseif ($this->itemType() == "accessory") { + $itemicon = 'fa fa-keyboard-o'; + } elseif ($this->itemType()=="consumable") { + $itemicon = 'fa fa-tint'; + } elseif ($this->itemType()=="license") { + $itemicon = 'fa fa-floppy-o'; + } elseif ($this->itemType()=="component") { + $itemicon = 'fa fa-hdd-o'; + } else { + $itemicon = 'fa fa-paperclip'; + } + + return $itemicon; + } + + + public function actionType() { + return strtolower(trans('general.'.str_replace(' ', '_', $this->action_type))); + } + + + public function target() { $target = null;