'array', 'enum_opsi' => 'array', ]; protected static function booted() { static::creating(function ($model) { $max = self::where('tabel_id', $model->tabel_id)->max('urutan'); $model->urutan = ($max ?? 0) + 1; }); static::addGlobalScope('order', function (Builder $builder) { $builder->orderBy('urutan'); }); } public function tabel(): BelongsTo { return $this->belongsTo(TabelBasisData::class, 'tabel_id'); } }