api code global jain
This commit is contained in:
@@ -0,0 +1,75 @@
|
||||
<?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();
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user