/** * Deletes the specified operating system. * * @param int|string $id * * @return \Illuminate\Http\RedirectResponse */ public function destroy($id) { $system = $this->system->findOrFail($id); if ($system->delete()) { flash()->success('Success!', 'Successfully deleted operating system.'); return redirect()->route('computer-systems.index'); } flash()->error('Error!', 'There was an issue deleting this operating system. Please try again.'); return redirect()->route('computer-systems.index'); }
/** * 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; }