Set Default when Creating Record from Relation

So I have a relation manager on my CyclesResource the Relation basically shows a list of PostingResources when the user hits "New Posting" button I would like to pass in the current cycle id and make it as Read Only so that the user does not have to select this field as it seems counter intutive to have to do so since you created the posting from the cycle? Is there a way to do this? I've tried both:
CreateAction::make()
->mutateDataUsing(fn (array $data) => array_merge($data, ['cycle_id' => $this->ownerRecord->id]))
CreateAction::make()
->mutateDataUsing(fn (array $data) => array_merge($data, ['cycle_id' => $this->ownerRecord->id]))
CreateAction::make()
->using(function (array $data, string $model): Model {
$data['cycle_id'] = $this->ownerRecord->id;
return $model::create($data);
})
CreateAction::make()
->using(function (array $data, string $model): Model {
$data['cycle_id'] = $this->ownerRecord->id;
return $model::create($data);
})
But when the page loads for inserting a posting, the Cycle Select is blank...
No description
0 Replies
No replies yetBe the first to reply to this messageJoin

Did you find this page helpful?