mirror of
https://github.com/coollabsio/coolify.git
synced 2025-12-28 13:41:51 +00:00
Changes: 1. Remove description field from cloud-init scripts - Updated migration to remove description column - Updated model to remove description from fillable array 2. Redesign script name input layout - Move script name input next to checkbox (always visible) - Remove conditional rendering - input always shown - Use placeholder instead of label for cleaner look 3. Fix dropdown type error - Replace wire:change event with wire:model.live - Use updatedSelectedCloudInitScriptId() lifecycle hook - Add "disabled" attribute to placeholder option - Properly handle empty string vs null in type casting 4. Improve validation - Require both script content AND name for saving - Remove description validation rule - Add selected_cloud_init_script_id validation 5. Auto-populate name when loading saved script - When user selects saved script, auto-fill the name field 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
34 lines
623 B
PHP
34 lines
623 B
PHP
<?php
|
|
|
|
namespace App\Models;
|
|
|
|
use Illuminate\Database\Eloquent\Model;
|
|
|
|
class CloudInitScript extends Model
|
|
{
|
|
protected $fillable = [
|
|
'team_id',
|
|
'name',
|
|
'script',
|
|
];
|
|
|
|
protected function casts(): array
|
|
{
|
|
return [
|
|
'script' => 'encrypted',
|
|
];
|
|
}
|
|
|
|
public function team()
|
|
{
|
|
return $this->belongsTo(Team::class);
|
|
}
|
|
|
|
public static function ownedByCurrentTeam(array $select = ['*'])
|
|
{
|
|
$selectArray = collect($select)->concat(['id']);
|
|
|
|
return self::whereTeamId(currentTeam()->id)->select($selectArray->all());
|
|
}
|
|
}
|