63 lines
1.3 KiB
PHP
63 lines
1.3 KiB
PHP
|
|
<?php
|
||
|
|
|
||
|
|
namespace App\Models\Traits\Jati\Attributes;
|
||
|
|
|
||
|
|
use App\Constant\Constant;
|
||
|
|
use App\Traits\ActionButtons;
|
||
|
|
|
||
|
|
trait JatiAttributes
|
||
|
|
{
|
||
|
|
use ActionButtons;
|
||
|
|
|
||
|
|
/**
|
||
|
|
* @return string
|
||
|
|
*/
|
||
|
|
public function getJatiStatusActionAttribute(): string
|
||
|
|
{
|
||
|
|
return $this->statusLabel($this->status);
|
||
|
|
}
|
||
|
|
|
||
|
|
/**
|
||
|
|
* @return string
|
||
|
|
*/
|
||
|
|
public function getJatiEditActionAttribute(): string
|
||
|
|
{
|
||
|
|
return $this->editButton(route('admin.jati.edit', $this->id), 'Edit Jati');
|
||
|
|
}
|
||
|
|
|
||
|
|
/**
|
||
|
|
* @return string
|
||
|
|
*/
|
||
|
|
public function getJatiDeleteActionAttribute(): string
|
||
|
|
{
|
||
|
|
// if (loggedInUser()->id != $this->id) {
|
||
|
|
return $this->deleteButton($this->id, 'Delete Jati');
|
||
|
|
// }
|
||
|
|
|
||
|
|
return "";
|
||
|
|
}
|
||
|
|
|
||
|
|
/**
|
||
|
|
* @return string
|
||
|
|
*/
|
||
|
|
public function getJatiCheckboxActionAttribute(): string
|
||
|
|
{
|
||
|
|
return $this->checkboxAction($this);
|
||
|
|
}
|
||
|
|
|
||
|
|
/**
|
||
|
|
* @return string
|
||
|
|
*/
|
||
|
|
public function getJatiActionButtonsAttribute(): string
|
||
|
|
{
|
||
|
|
$action = $this->jati_edit_action;
|
||
|
|
$action =$action.$this->jati_view_action;
|
||
|
|
if (loggedInUser()->isSuperAdmin() || loggedInUser()->isAdmin()) {
|
||
|
|
if (!$this->userDetails()->exists()) {
|
||
|
|
$action =$action.$this->jati_delete_action;
|
||
|
|
}
|
||
|
|
}
|
||
|
|
return $action;
|
||
|
|
}
|
||
|
|
}
|