79 lines
1.8 KiB
PHP
79 lines
1.8 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 Package extends Model
|
|
{
|
|
use HasFactory;
|
|
use IsCrudModel;
|
|
|
|
/**
|
|
* Indicates if the model should be timestamped.
|
|
*
|
|
* @var boolean
|
|
*/
|
|
public $timestamps = false;
|
|
|
|
/**
|
|
* Crud label column
|
|
*
|
|
* @var string
|
|
*/
|
|
protected $crudLabelColumn = 'name';
|
|
|
|
/**
|
|
* Crud value column
|
|
*
|
|
* @var string
|
|
*/
|
|
protected $crudValueColumn = 'id';
|
|
|
|
/**
|
|
* The attributes that are mass assignable.
|
|
*
|
|
* @var array
|
|
*/
|
|
protected $fillable = [
|
|
'name', 'amount'
|
|
];
|
|
|
|
/**
|
|
* Package
|
|
*
|
|
* @param array $attributes
|
|
*/
|
|
public function __construct(array $attributes = [])
|
|
{
|
|
self::$editableProperties = [
|
|
'name' => [
|
|
'label' => trans('Nom'),
|
|
'type' => CrudType::string(),
|
|
'nullable' => false,
|
|
'actions' => [
|
|
CrudAction::viewAny(),
|
|
CrudAction::view(),
|
|
CrudAction::update(),
|
|
CrudAction::create()
|
|
]
|
|
],
|
|
'amount' => [
|
|
'label' => trans('Montant (par jour)'),
|
|
'type' => CrudType::float(),
|
|
'nullable' => false,
|
|
'actions' => [
|
|
CrudAction::viewAny(),
|
|
CrudAction::view(),
|
|
CrudAction::update(),
|
|
CrudAction::create()
|
|
]
|
|
],
|
|
];
|
|
parent::__construct($attributes);
|
|
}
|
|
}
|