api code global jain
This commit is contained in:
62
app/Models/Traits/Dharma/Attributes/DharmaAttributes.php
Normal file
62
app/Models/Traits/Dharma/Attributes/DharmaAttributes.php
Normal file
@@ -0,0 +1,62 @@
|
||||
<?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;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user