63 lines
1.4 KiB
PHP
63 lines
1.4 KiB
PHP
<?php
|
|
|
|
namespace App\Models\Traits\Dharma\Attributes;
|
|
|
|
use App\Constant\Constant;
|
|
use App\Traits\ActionButtons;
|
|
|
|
trait DharmaAttributes
|
|
{
|
|
use ActionButtons;
|
|
|
|
/**
|
|
* @return string
|
|
*/
|
|
public function getDharmaStatusActionAttribute(): string
|
|
{
|
|
return $this->statusLabel($this->status);
|
|
}
|
|
|
|
/**
|
|
* @return string
|
|
*/
|
|
public function getDharmaEditActionAttribute(): string
|
|
{
|
|
return $this->editButton(route('admin.dharma.edit', $this->id), 'Edit Dharma');
|
|
}
|
|
|
|
/**
|
|
* @return string
|
|
*/
|
|
public function getDharmaDeleteActionAttribute(): string
|
|
{
|
|
// if (loggedInUser()->id != $this->id) {
|
|
return $this->deleteButton($this->id, 'Delete Dharma');
|
|
// }
|
|
|
|
return "";
|
|
}
|
|
|
|
/**
|
|
* @return string
|
|
*/
|
|
public function getDharmaCheckboxActionAttribute(): string
|
|
{
|
|
return $this->checkboxAction($this);
|
|
}
|
|
|
|
/**
|
|
* @return string
|
|
*/
|
|
public function getDharmaActionButtonsAttribute(): string
|
|
{
|
|
$action = $this->dharma_edit_action;
|
|
$action = $action.$this->dharma_view_action;
|
|
if (loggedInUser()->isSuperAdmin() || loggedInUser()->isAdmin()) {
|
|
if (!$this->users()->exists() && !$this->sants()->exists()) {
|
|
$action =$action.$this->dharma_delete_action;
|
|
}
|
|
}
|
|
return $action;
|
|
}
|
|
}
|