63 lines
1.4 KiB
PHP
63 lines
1.4 KiB
PHP
|
|
<?php
|
||
|
|
|
||
|
|
namespace App\Models\Traits\Sampraday\Attributes;
|
||
|
|
|
||
|
|
use App\Constant\Constant;
|
||
|
|
use App\Traits\ActionButtons;
|
||
|
|
|
||
|
|
trait SampradayAttributes
|
||
|
|
{
|
||
|
|
use ActionButtons;
|
||
|
|
|
||
|
|
/**
|
||
|
|
* @return string
|
||
|
|
*/
|
||
|
|
public function getSampradayStatusActionAttribute(): string
|
||
|
|
{
|
||
|
|
return $this->statusLabel($this->status);
|
||
|
|
}
|
||
|
|
|
||
|
|
/**
|
||
|
|
* @return string
|
||
|
|
*/
|
||
|
|
public function getSampradayEditActionAttribute(): string
|
||
|
|
{
|
||
|
|
return $this->editButton(route('admin.sampraday.edit', $this->id), 'Edit Sampraday');
|
||
|
|
}
|
||
|
|
|
||
|
|
/**
|
||
|
|
* @return string
|
||
|
|
*/
|
||
|
|
public function getSampradayDeleteActionAttribute(): string
|
||
|
|
{
|
||
|
|
// if (loggedInUser()->id != $this->id) {
|
||
|
|
return $this->deleteButton($this->id, 'Delete Sampraday');
|
||
|
|
// }
|
||
|
|
|
||
|
|
return "";
|
||
|
|
}
|
||
|
|
|
||
|
|
/**
|
||
|
|
* @return string
|
||
|
|
*/
|
||
|
|
public function getSampradayCheckboxActionAttribute(): string
|
||
|
|
{
|
||
|
|
return $this->checkboxAction($this);
|
||
|
|
}
|
||
|
|
|
||
|
|
/**
|
||
|
|
* @return string
|
||
|
|
*/
|
||
|
|
public function getSampradayActionButtonsAttribute(): string
|
||
|
|
{
|
||
|
|
$action = $this->sampraday_edit_action;
|
||
|
|
$action =$action.$this->sampraday_view_action;
|
||
|
|
if (loggedInUser()->isSuperAdmin() || loggedInUser()->isAdmin()) {
|
||
|
|
if (!$this->sants()->exists()) {
|
||
|
|
$action =$action.$this->sampraday_delete_action;
|
||
|
|
}
|
||
|
|
}
|
||
|
|
return $action;
|
||
|
|
}
|
||
|
|
}
|