src/TagRepository.php
public function getIdForSlug($slug, User $user = null)
    {
        $query = Tag::where('slug', 'like', $slug);

        return $this->scopeVisibleTo($query, $user)->pluck('id');
    }
public function getIdForSlug($slug, User $user = null)
    {
        $query = Tag::where('slug', 'like', $slug);

        return $this->scopeVisibleTo($query, $user)->pluck('id');
    }
public function getIdForSlug ( $ slug , User $ user = null ) { $ query = Tag :: where ( 'slug' , 'like' , $ slug ) ; return $ this -> scopeVisibleTo ( $ query , $ user ) -> pluck ( 'id' ) ; }
Get the ID of a tag with the given slug.

@param string $slug
@param User|null $user
@return int
Get the ID of a tag with the given slug .