63 lines
1.5 KiB
PHP
63 lines
1.5 KiB
PHP
<?php
|
|
|
|
namespace App\Models;
|
|
|
|
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
|
use Illuminate\Database\Eloquent\Model;
|
|
use Kwaadpepper\CrudPolicies\Enums\CrudAction;
|
|
use Kwaadpepper\CrudPolicies\Enums\CrudType;
|
|
use Kwaadpepper\CrudPolicies\Traits\IsCrudModel;
|
|
|
|
class Log extends Model
|
|
{
|
|
use HasFactory;
|
|
use IsCrudModel;
|
|
|
|
protected $crudLabelColumn = 'id';
|
|
|
|
protected $crudValueColumn = 'id';
|
|
|
|
protected $fillable = ['entry'];
|
|
|
|
public function __construct($attributes = [])
|
|
{
|
|
self::$editableProperties = [
|
|
'id' => [
|
|
'label' => trans('ID'),
|
|
'type' => CrudType::unsignedint(),
|
|
'actions' => [
|
|
CrudAction::viewAny(),
|
|
CrudAction::view()
|
|
]
|
|
],
|
|
'entry' => [
|
|
'label' => trans('Entrée'),
|
|
'type' => CrudType::text(),
|
|
'required' => true,
|
|
'nullable' => false,
|
|
'actions' => [
|
|
CrudAction::viewAny(),
|
|
CrudAction::view(),
|
|
CrudAction::create(),
|
|
CrudAction::update(),
|
|
]
|
|
]
|
|
];
|
|
parent::__construct($attributes);
|
|
}
|
|
|
|
public function parent()
|
|
{
|
|
return $this->morphTo();
|
|
}
|
|
|
|
public function parentSite()
|
|
{
|
|
return $this->morphTo('parent', 'site');
|
|
}
|
|
|
|
public function parentProject()
|
|
{
|
|
return $this->morphTo('parent', 'project');
|
|
}
|
|
}
|