Replies: 1 comment
-
|
I reply to myself: The problem was that I had added ->model(MyModel::class) to the form in order to avoid it saving a HasMany relationship as a JSON field. It did not work and at the same time it created this unrelated error. Removed the ->model() modifier and $record got set. |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
I have a blocking problem.
My code in v2 was working flawlessly until I moved it to v3.
Now it seems that all injections of the $record variable to my form get set to null.
public static function form(Form $form): Form
{
return $form->schema([ Grid::make(4)->schema([
Forms\Components\Placeholder::make('SomeInventedName')
->content(function (?ModelName $record): string { return self::someFunction($record); }),
Forms\Components\Placeholder::make('SomeOtherInventedName')
->content(function (Model $record): string { return self::someFunction($record); }),
Forms\Components\Repeater::make('files')
->relationship('files')
->schema([
Forms\Components\Placeholder::make(' ')->content(function (?File $record) { return self::someOtherFunc($record);}),
]),
...
Nor ModelName $record, nor Model $record work. When the function is executed, $record is given with a Null value.
In v2 I used to have the record there, so I could play with it.
It is a blocking problem and I have no clue how to work it out. It might be that it exclusive of me, as I don't see any other people talking about it, but I don't know what the cause could be.
I don't remember having to many problems with the upgrade from v2 to v3.
Can anyone give me some clue of what is going on? Maybe there is another way to access the record? Maybe I am forgetting something?
Beta Was this translation helpful? Give feedback.
All reactions