Merge branch 'trunk'

This commit is contained in:
Jérémy Munsch 2021-07-27 14:51:32 +02:00
commit 25e380421c
2 changed files with 83 additions and 1 deletions

View file

@ -22,7 +22,10 @@ class Site extends Model
protected $crudValueColumn = 'id';
protected $fillable = ['name'];
protected $fillable = [
'name', 'status',
'description', 'todo'
];
public function __construct($attributes = [])
{
@ -43,6 +46,49 @@ class Site extends Model
CrudAction::update(),
]
],
'status' => [
'label' => trans('État'),
'type' => CrudType::string(),
'validate' => [
'string',
'max:255'
],
'required' => true,
'nullable' => false,
'actions' => [
CrudAction::view(),
CrudAction::create(),
CrudAction::update(),
]
],
'description' => [
'label' => trans('Description'),
'type' => CrudType::text(),
'validate' => [
'string'
],
'required' => true,
'nullable' => false,
'actions' => [
CrudAction::view(),
CrudAction::create(),
CrudAction::update(),
]
],
'todo' => [
'label' => trans('À Faire'),
'type' => CrudType::text(),
'validate' => [
'string'
],
'required' => false,
'nullable' => true,
'actions' => [
CrudAction::view(),
CrudAction::create(),
CrudAction::update(),
]
],
'users' => [
'label' => trans('Utilisateurs'),
'type' => CrudType::belongsToMany(),

View file

@ -0,0 +1,36 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
class AddTodoOnSitesTable extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::table('sites', function (Blueprint $table) {
$table->string('status')->after('name');
$table->text('description')->after('status');
$table->text('todo')->after('description')->nullable();
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::table('sites', function (Blueprint $table) {
$table->dropColumn('status');
$table->dropColumn('description');
$table->dropColumn('todo');
});
}
}