Fix mounts

This commit is contained in:
Lance Pioch 2024-05-11 22:08:23 -04:00
parent 2c98693bd2
commit 30452890f5
2 changed files with 13 additions and 1 deletions

View File

@ -3,18 +3,22 @@
namespace App\Filament\Resources\MountResource\Pages;
use App\Filament\Resources\MountResource;
use App\Services\Servers\ServerCreationService;
use Filament\Forms\Components\Group;
use Filament\Forms\Components\Section;
use Filament\Forms\Components\Select;
use Filament\Forms\Form;
use Filament\Resources\Pages\CreateRecord;
use Filament\Forms;
use Illuminate\Database\Eloquent\Model;
use Illuminate\Support\Str;
class CreateMount extends CreateRecord
{
protected static string $resource = MountResource::class;
protected static bool $canCreateAnother = false;
public function form(Form $form): Form
{
return $form
@ -71,6 +75,7 @@ class CreateMount extends CreateRecord
Forms\Components\Textarea::make('description')
->helperText('A longer description for this mount.')
->columnSpanFull(),
Forms\Components\Hidden::make('user_mountable')->default(1),
])->columnSpan(1)->columns([
'default' => 1,
'lg' => 2,
@ -94,4 +99,11 @@ class CreateMount extends CreateRecord
'lg' => 2,
]);
}
protected function handleRecordCreation(array $data): Model
{
$data['uuid'] ??= Str::uuid()->toString();
return parent::handleRecordCreation($data);
}
}

View File

@ -34,7 +34,7 @@ class Mount extends Model
/**
* Fields that are not mass assignable.
*/
protected $guarded = ['id', 'uuid'];
protected $guarded = ['id'];
/**
* Rules verifying that the data being stored matches the expectations of the database.