61 lines
1.3 KiB
PHP
61 lines
1.3 KiB
PHP
<?php
|
|
|
|
namespace App\Models\Traits\Role\Attributes;
|
|
|
|
use App\Constant\Constant;
|
|
use App\Traits\ActionButtons;
|
|
|
|
trait RoleAttributes
|
|
{
|
|
use ActionButtons;
|
|
|
|
/**
|
|
* @return string
|
|
*/
|
|
public function getRoleStatusActionAttribute(): string
|
|
{
|
|
return $this->statusLabel($this->status);
|
|
}
|
|
|
|
/**
|
|
* @return string
|
|
*/
|
|
public function getRoleEditActionAttribute(): string
|
|
{
|
|
return $this->editButton(route('admin.roles.edit', $this->id), 'Edit Role');
|
|
}
|
|
|
|
/**
|
|
* @return string
|
|
*/
|
|
public function getRoleDeleteActionAttribute(): string
|
|
{
|
|
// if (loggedInUser()->id != $this->id) {
|
|
return $this->deleteButton($this->id, 'Delete Role');
|
|
// }
|
|
|
|
return "";
|
|
}
|
|
|
|
/**
|
|
* @return string
|
|
*/
|
|
public function getRoleCheckboxActionAttribute(): string
|
|
{
|
|
return $this->checkboxAction($this);
|
|
}
|
|
|
|
/**
|
|
* @return string
|
|
*/
|
|
public function getRoleActionButtonsAttribute(): string
|
|
{
|
|
$action = $this->role_edit_action;
|
|
$action = $action.$this->role_view_action;
|
|
if (loggedInUser()->isSuperAdmin() || loggedInUser()->isAdmin()) {
|
|
// $action =$action.$this->role_delete_action;
|
|
}
|
|
return $action;
|
|
}
|
|
}
|