/** * Execute the job. * * @return Computer|bool */ public function handle() { $this->computer->os_id = OperatingSystem::findOrFail($this->request->input('os'))->id; $this->computer->type_id = ComputerType::findOrFail($this->request->input('type'))->id; $this->computer->name = $this->request->input('name'); $this->computer->ip = $this->request->input('ip'); $this->computer->model = $this->request->input('model'); $this->computer->description = $this->request->input('description'); if ($this->computer->save()) { return $this->computer; } return false; }
/** * Creates a new computer from active directory. * * @param ComputerRequest $request * * @return Computer|bool */ protected function storeFromActiveDirectory(ComputerRequest $request) { $computer = $this->adldap->getProvider('default')->search()->computers()->find($request->input('name')); if ($computer instanceof AdComputer) { return $this->dispatch(new ImportComputer($computer)); } return false; }