76 lines
1.8 KiB
PHP
76 lines
1.8 KiB
PHP
<?php
|
|
|
|
namespace App\Models\Traits\ChaturmasDate\Attributes;
|
|
|
|
use App\Traits\ActionButtons;
|
|
|
|
trait ChaturmasDateAttributes
|
|
{
|
|
use ActionButtons;
|
|
|
|
/**
|
|
* @return string
|
|
*/
|
|
public function getChaturmasDateStatusActionAttribute(): string
|
|
{
|
|
return $this->statusLabel($this->status);
|
|
}
|
|
|
|
/**
|
|
* @return string
|
|
*/
|
|
public function getChaturmasDateEditActionAttribute(): string
|
|
{
|
|
return $this->editButton(route('admin.chaturmas-date.edit', $this->id), 'Edit Chaturmas Date');
|
|
}
|
|
|
|
/**
|
|
* @return string
|
|
*/
|
|
public function getChaturmasDateDeleteActionAttribute(): string
|
|
{
|
|
// if (loggedInUser()->id != $this->id) {
|
|
return $this->deleteButton($this->id, 'Delete Chaturmas Date');
|
|
// }
|
|
|
|
return "";
|
|
}
|
|
|
|
/**
|
|
* @return string
|
|
*/
|
|
public function getChaturmasDateCheckboxActionAttribute(): string
|
|
{
|
|
return $this->checkboxAction($this);
|
|
}
|
|
|
|
/**
|
|
* @return string
|
|
*/
|
|
public function getChaturmasDateActionButtonsAttribute(): string
|
|
{
|
|
$action = $this->chaturmas_date_edit_action;
|
|
$action =$action.$this->chaturmas_date_view_action;
|
|
if (loggedInUser()->isSuperAdmin() || loggedInUser()->isAdmin()) {
|
|
// if (!$this->chaturmas()->exists()) {
|
|
$action =$action.$this->chaturmas_date_delete_action;
|
|
// }
|
|
}
|
|
return $action;
|
|
}
|
|
|
|
/**
|
|
* Returns model in days since created_at.
|
|
*/
|
|
public function getCreatedAgoAttribute() {
|
|
return $this->created_at->diffForHumans();
|
|
}
|
|
|
|
/**
|
|
* Returns model in days since updated_at.
|
|
*/
|
|
public function getUpdatedAgoAttribute() {
|
|
return $this->updated_at->diffForHumans();
|
|
}
|
|
}
|