/** * @param NewTagRequest $request * * @return RedirectResponse */ public function store(NewTagRequest $request) { $tag = $this->tagRepository->create($request->all()); if (isset($tag->id)) { $this->webUi->successMessage("Created new tag `{$tag->name}`"); } else { $this->webUi->errorMessage('Failed to create new tag'); } return $this->redirectToTagsIndex(); }
/** * Should be able to create a tag. */ public function testCreate() { $tagAttributes = ['name' => str_random()]; $this->tagModel->shouldReceive('create')->with($tagAttributes)->andReturnSelf(); $this->tagRepository->create($tagAttributes); }