コード例 #1
0
 /**
  * @param int    $tagId
  * @param string $tagName
  *
  * @throws \Illuminate\Database\Eloquent\ModelNotFoundException
  *
  * @return \Illuminate\Contracts\View\View|\Illuminate\Http\RedirectResponse
  */
 public function viewAction(int $tagId, string $tagName)
 {
     $tag = $this->tagRepository->loadById($tagId);
     if ($tag->name !== $tagName) {
         return $this->responseFactory->redirectToRoute('tag.view', ['id' => $tag->id, $tag->name]);
     }
     return $this->viewFactory->make('customer.tag.view', compact('tag'));
 }
コード例 #2
0
 /**
  * Should be able to load a tag by id.
  */
 public function testLoadById()
 {
     $this->tagModel->shouldReceive('where->with->firstOrFail')->andReturnSelf();
     $this->tagRepository->loadById(5);
 }