Example #1
0
 /**
  * Execute the command.
  *
  * @return void
  */
 public function handle()
 {
     $template = Project::findOrFail($this->template_id);
     foreach ($template->commands as $command) {
         $data = $command->toArray();
         $data['project_id'] = $this->project->id;
         Command::create($data);
     }
     foreach ($template->sharedFiles as $file) {
         $data = $file->toArray();
         $data['project_id'] = $this->project->id;
         SharedFile::create($data);
     }
     foreach ($template->projectFiles as $file) {
         $data = $file->toArray();
         $data['project_id'] = $this->project->id;
         ProjectFile::create($data);
     }
 }