What about
$request->merge([
'field' => 'value',
]);
and add the request var via construct?
Are you trying to fake the form data to send it again?
Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.
Hello all,
I currently have an Entrymodel - of which when a user submits a form, the entire request object is passed to a custom method I have created that handles the creation or updating of an entry. Here's how it currently works.
public function store(EntryRequest $request)
{
$entry = Entry::generate($request);
// other stuff like flashing message and redirecting.
}
What I want to now do, is manually fetch a group of these entries (that already exist) - build up a request and run the same generate method I have set up.
So currently, what I've done is create a new console command - with when ran, will simply loop these entries and run the same generate method on them.
So my question is, is it possible to manually build up a request object?
I hope this makes sense!
Edit: This is what I currently have on my command.
public function handle()
{
$entries = Entry::legacy()->processed()->get();
foreach($entries as $entry)
{
// Create a request object here? Let's assume I assign this to a $request variable
Entry::generate($request, $entry); // passing the created request and entry itself
$this->info('Successfully converted entry #' . $entry->id);
}
}
What about
$request->merge([
'field' => 'value',
]);
and add the request var via construct?
Are you trying to fake the form data to send it again?
Please or to participate in this conversation.