Пример #1
0
 /**
  * @param \Minhbang\Ebook\Ebook $ebook
  * @param string $slug
  *
  * @return bool
  */
 protected function checkPermission($ebook, $slug)
 {
     abort_unless($slug == $ebook->slug, 404);
     /** @var User $user */
     $user = user();
     /** @var Reader $reader */
     $reader = Reader::find($user->id);
     return $user->hasRole('tv.*') || $ebook->isPublished() && $reader && $reader->canRead($ebook);
 }