api code global jain
This commit is contained in:
60
app/Models/Traits/Role/Attributes/RoleAttributes.php
Normal file
60
app/Models/Traits/Role/Attributes/RoleAttributes.php
Normal file
@@ -0,0 +1,60 @@
|
||||
<?php
|
||||
|
||||
namespace App\Models\Traits\Role\Attributes;
|
||||
|
||||
use App\Constant\Constant;
|
||||
use App\Traits\ActionButtons;
|
||||
|
||||
trait RoleAttributes
|
||||
{
|
||||
use ActionButtons;
|
||||
|
||||
/**
|
||||
* @return string
|
||||
*/
|
||||
public function getRoleStatusActionAttribute(): string
|
||||
{
|
||||
return $this->statusLabel($this->status);
|
||||
}
|
||||
|
||||
/**
|
||||
* @return string
|
||||
*/
|
||||
public function getRoleEditActionAttribute(): string
|
||||
{
|
||||
return $this->editButton(route('admin.roles.edit', $this->id), 'Edit Role');
|
||||
}
|
||||
|
||||
/**
|
||||
* @return string
|
||||
*/
|
||||
public function getRoleDeleteActionAttribute(): string
|
||||
{
|
||||
// if (loggedInUser()->id != $this->id) {
|
||||
return $this->deleteButton($this->id, 'Delete Role');
|
||||
// }
|
||||
|
||||
return "";
|
||||
}
|
||||
|
||||
/**
|
||||
* @return string
|
||||
*/
|
||||
public function getRoleCheckboxActionAttribute(): string
|
||||
{
|
||||
return $this->checkboxAction($this);
|
||||
}
|
||||
|
||||
/**
|
||||
* @return string
|
||||
*/
|
||||
public function getRoleActionButtonsAttribute(): string
|
||||
{
|
||||
$action = $this->role_edit_action;
|
||||
$action = $action.$this->role_view_action;
|
||||
if (loggedInUser()->isSuperAdmin() || loggedInUser()->isAdmin()) {
|
||||
// $action =$action.$this->role_delete_action;
|
||||
}
|
||||
return $action;
|
||||
}
|
||||
}
|
||||
12
app/Models/Traits/Role/Relationships/RoleRelationships.php
Normal file
12
app/Models/Traits/Role/Relationships/RoleRelationships.php
Normal file
@@ -0,0 +1,12 @@
|
||||
<?php
|
||||
|
||||
namespace App\Models\Traits\Role\Relationships;
|
||||
|
||||
/**
|
||||
* Trait UserRelationships
|
||||
* @package Domains\User\Models\Traits\Relationships
|
||||
*/
|
||||
trait RoleRelationships
|
||||
{
|
||||
//
|
||||
}
|
||||
Reference in New Issue
Block a user