add breadcrumbs
This commit is contained in:
parent
de9cb50084
commit
8dd6567ccc
21 changed files with 527 additions and 218 deletions
34
app/Models/ModelTrait.php
Normal file
34
app/Models/ModelTrait.php
Normal file
|
@ -0,0 +1,34 @@
|
|||
<?php
|
||||
|
||||
namespace App\Models;
|
||||
|
||||
trait ModelTrait
|
||||
{
|
||||
/**
|
||||
* @return string
|
||||
*/
|
||||
public function getEditButtonAttribute($permission, $route)
|
||||
{
|
||||
if (access()->allow($permission)) {
|
||||
return '<a href="'.route($route, $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($permission, $route)
|
||||
{
|
||||
if (access()->allow($permission)) {
|
||||
return '<a href="'.route($route, $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>';
|
||||
}
|
||||
}
|
||||
}
|
53
app/Models/Page.php
Normal file
53
app/Models/Page.php
Normal file
|
@ -0,0 +1,53 @@
|
|||
<?php
|
||||
|
||||
namespace App\Models;
|
||||
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
use App\User;
|
||||
|
||||
class Page extends Model
|
||||
{
|
||||
/**
|
||||
* The database table used by the model.
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
protected $table;
|
||||
|
||||
/**
|
||||
* The guarded field which are not mass assignable.
|
||||
*
|
||||
* @var array
|
||||
*/
|
||||
protected $guarded = ['id'];
|
||||
|
||||
/**
|
||||
* The default values for attributes.
|
||||
*
|
||||
* @var array
|
||||
*/
|
||||
protected $attributes = [
|
||||
'created_by' => 1,
|
||||
];
|
||||
|
||||
protected $with = ['owner'];
|
||||
|
||||
public function __construct(array $attributes = [])
|
||||
{
|
||||
parent::__construct($attributes);
|
||||
$this->table = 'pages';//config('module.pages.table');
|
||||
}
|
||||
|
||||
public function owner()
|
||||
{
|
||||
return $this->belongsTo(User::class, 'created_by');
|
||||
}
|
||||
|
||||
/**
|
||||
* @return bool
|
||||
*/
|
||||
public function isActive()
|
||||
{
|
||||
return $this->status == 1;
|
||||
}
|
||||
}
|
Loading…
Add table
editor.link_modal.header
Reference in a new issue