Support the ongoing development of Laravel.io →
Laravel
0

Hi @marketopiateam

Why don't you create a new instance of the Design in the submit method instead of the mount method and assign it after saving it in the database?

    public function submit()
{
    $this->validate();

    // Assign the selected project and post IDs to the design instance
    $design = new Design;
    $design->project_id = $this->selectedProjectId;
    $design->post_id = $this->design->post_id;
    $design->save();
    $this->design=$design;
    $this->syncMedia();
    event(new DesignCreated($this->design));

    return redirect()->route('admin.designs.index');
}
`````
0

Sign in to participate in this thread!

Eventy

Your banner here too?

Moderators

We'd like to thank these amazing companies for supporting us

Your logo here?

Laravel.io

The Laravel portal for problem solving, knowledge sharing and community building.

© 2024 Laravel.io - All rights reserved.