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