edit static pages in backend

This commit is contained in:
Arno Kaimbacher 2018-09-06 17:58:54 +02:00
parent e771c4921f
commit 783ac823ba
59 changed files with 1644 additions and 761 deletions

View file

@ -4,9 +4,11 @@ namespace App\Models;
use Illuminate\Database\Eloquent\Model;
use App\User;
use App\Models\ModelTrait;
class Page extends Model
{
use ModelTrait;
/**
* The database table used by the model.
*
@ -43,6 +45,40 @@ class Page extends Model
return $this->belongsTo(User::class, 'created_by');
}
/**
* @return string
*/
public function getActionButtonsAttribute()
{
return '<div class="btn-group action-btn">
'.$this->getEditButtonAttribute('page', 'settings.page.edit').'
'.$this->getViewButtonAttribute().'
'.$this->getDeleteButtonAttribute('page', 'settings.page.destroy').'
</div>';
}
/**
* @return string
*/
public function getViewButtonAttribute()
{
return '<a target="_blank" href="'. route('frontend.pages.show', $this->page_slug) .'" class="btn btn-flat btn-default">
<i data-toggle="tooltip" data-placement="top" title="View Page" class="fa fa-eye"></i>
</a>';
}
/**
* @return string
*/
public function getStatusLabelAttribute()
{
if ($this->isActive()) {
return "<label class='label label-success'>".trans('labels.general.active').'</label>';
}
return "<label class='label label-danger'>".trans('labels.general.inactive').'</label>';
}
/**
* @return bool
*/