diff --git a/app/Models/Site.php b/app/Models/Site.php index 0a44094..e8f47f5 100644 --- a/app/Models/Site.php +++ b/app/Models/Site.php @@ -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(), diff --git a/database/migrations/2021_07_27_144557_add_todo_on_sites_table.php b/database/migrations/2021_07_27_144557_add_todo_on_sites_table.php new file mode 100644 index 0000000..4e94070 --- /dev/null +++ b/database/migrations/2021_07_27_144557_add_todo_on_sites_table.php @@ -0,0 +1,36 @@ +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'); + }); + } +}