Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.

kyos's avatar
Level 6

Save data into two different tables

Hi guys here is my doubt. Im using "Commander" a really good package created by Jeffrey Way. And I want to save data into 2 separated tables. Here is my "handle" command:

public function handle($command)
{
    $link = createStringRandom();

    $upload = Upload::register($command->name, $command->email, $command->body, $link);
    $this->repository->save($upload);
    $upload_id = $upload->id;

    $emailfriends = Email::register($upload_id, $command->emailfriend);
    $this->repository->saveMultiple($emailfriends);

    $this->dispatchEventsFor($upload);

    return $upload;
}

1- I think this "handle" function is doing to much. 2- I want to create a 3 table for my files. Im doing this right?

0 likes
0 replies

Please or to participate in this conversation.