/** * Remove the specified resource from storage. * * @param int $id * @return \Illuminate\Http\Response */ public function destroy($id) { $key = Key::whereId($id)->first(); if (empty($key)) { return $this->saveResponse(false); } return $this->saveResponse($key->delete()); }
/** * Handle the command. * * @param UpdateKeyCommand $command * @return void */ public function handle(UpdateKeyCommand $command) { $key = Key::whereId($command->id)->first(); if (!empty($key)) { $key->colour = $command->colour; $key->title = $command->title; $key->description = $command->description; if ($key->save()) { return $key; } } return false; }