/** * Execute the job. * * @return void */ public function handle() { // /** // * Create Product // */ // $product = $product->create([ // 'name' => $this->request->get('name'), // 'code' => $this->request->get('code'), // 'image' => $this->moveFile($this->image, '/image/products/', 'figurine'), // ]); // // /** // * Create Product Profile // */ // $product->profile()->create([ // 'description' => $this->request->get('description'), // 'image' => $this->moveFile($this->poster, '/image/products/', 'poster') // ]); $this->product->update(['name' => $this->request->get('name'), 'code' => $this->request->get('code'), 'image' => $this->files->has('image') ? $this->moveFile($this->files->get('image'), '/image/products/', 'figurine') : $this->product->image]); $this->product->profile->update(['description' => $this->request->get('description'), 'image' => $this->files->has('poster') ? $this->moveFile($this->files->get('poster'), '/image/products/', 'poster') : $this->product->profile->image]); }