Fix mounts
This commit is contained in:
parent
2c98693bd2
commit
30452890f5
@ -3,18 +3,22 @@
|
|||||||
namespace App\Filament\Resources\MountResource\Pages;
|
namespace App\Filament\Resources\MountResource\Pages;
|
||||||
|
|
||||||
use App\Filament\Resources\MountResource;
|
use App\Filament\Resources\MountResource;
|
||||||
|
use App\Services\Servers\ServerCreationService;
|
||||||
use Filament\Forms\Components\Group;
|
use Filament\Forms\Components\Group;
|
||||||
use Filament\Forms\Components\Section;
|
use Filament\Forms\Components\Section;
|
||||||
use Filament\Forms\Components\Select;
|
use Filament\Forms\Components\Select;
|
||||||
use Filament\Forms\Form;
|
use Filament\Forms\Form;
|
||||||
use Filament\Resources\Pages\CreateRecord;
|
use Filament\Resources\Pages\CreateRecord;
|
||||||
use Filament\Forms;
|
use Filament\Forms;
|
||||||
|
use Illuminate\Database\Eloquent\Model;
|
||||||
|
use Illuminate\Support\Str;
|
||||||
|
|
||||||
class CreateMount extends CreateRecord
|
class CreateMount extends CreateRecord
|
||||||
{
|
{
|
||||||
protected static string $resource = MountResource::class;
|
protected static string $resource = MountResource::class;
|
||||||
|
|
||||||
protected static bool $canCreateAnother = false;
|
protected static bool $canCreateAnother = false;
|
||||||
|
|
||||||
public function form(Form $form): Form
|
public function form(Form $form): Form
|
||||||
{
|
{
|
||||||
return $form
|
return $form
|
||||||
@ -71,6 +75,7 @@ class CreateMount extends CreateRecord
|
|||||||
Forms\Components\Textarea::make('description')
|
Forms\Components\Textarea::make('description')
|
||||||
->helperText('A longer description for this mount.')
|
->helperText('A longer description for this mount.')
|
||||||
->columnSpanFull(),
|
->columnSpanFull(),
|
||||||
|
Forms\Components\Hidden::make('user_mountable')->default(1),
|
||||||
])->columnSpan(1)->columns([
|
])->columnSpan(1)->columns([
|
||||||
'default' => 1,
|
'default' => 1,
|
||||||
'lg' => 2,
|
'lg' => 2,
|
||||||
@ -94,4 +99,11 @@ class CreateMount extends CreateRecord
|
|||||||
'lg' => 2,
|
'lg' => 2,
|
||||||
]);
|
]);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
protected function handleRecordCreation(array $data): Model
|
||||||
|
{
|
||||||
|
$data['uuid'] ??= Str::uuid()->toString();
|
||||||
|
|
||||||
|
return parent::handleRecordCreation($data);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -34,7 +34,7 @@ class Mount extends Model
|
|||||||
/**
|
/**
|
||||||
* Fields that are not mass assignable.
|
* 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.
|
* Rules verifying that the data being stored matches the expectations of the database.
|
||||||
|
Loading…
x
Reference in New Issue
Block a user