Created
January 26, 2018 09:37
-
-
Save bvipul/35b9e32f206df89abfc504b3daf881cc to your computer and use it in GitHub Desktop.
Old Attribute File
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
namespace App\Models\Blogs\Traits\Attribute; | |
/** | |
* Class BlogAttribute. | |
*/ | |
trait BlogAttribute | |
{ | |
/** | |
* @return string | |
*/ | |
public function getEditButtonAttribute() | |
{ | |
if(access()->allow('edit-blog')) | |
{ | |
return '<a href="'.route('admin.blogs.edit', $this).'" class="btn btn-flat btn-default"> | |
<i data-toggle="tooltip" data-placement="top" title="Edit" class="fa fa-pencil"></i> | |
</a>'; | |
} | |
} | |
/** | |
* @return string | |
*/ | |
public function getDeleteButtonAttribute() | |
{ | |
if(access()->allow('delete-blog')) | |
{ | |
return '<a href="'.route('admin.blogs.destroy', $this).'" | |
class="btn btn-flat btn-default" data-method="delete" | |
data-trans-button-cancel="'.trans('buttons.general.cancel').'" | |
data-trans-button-confirm="'.trans('buttons.general.crud.delete').'" | |
data-trans-title="'.trans('strings.backend.general.are_you_sure').'"> | |
<i data-toggle="tooltip" data-placement="top" title="Delete" class="fa fa-trash"></i> | |
</a>'; | |
} | |
} | |
/** | |
* @return string | |
*/ | |
public function getActionButtonsAttribute() | |
{ | |
return '<div class="btn-group action-btn">'. | |
$this->getEditButtonAttribute(). | |
$this->getDeleteButtonAttribute(). | |
'</div>'; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment