classes/Models/Base.php
public static function findBySlugOrFail($slug, array $columns = ['*'])
    {
        // Model not found, throw exception
        if (!$item = static::findBySlug($slug)) {
            throw (new ModelNotFoundException)->setModel(get_called_class());
        }

        // Return the model if visible
        $item->enforceVisibility();

        return $item;
    }
public static function findBySlugOrFail($slug, array $columns = ['*'])
    {
        // Model not found, throw exception
        if (!$item = static::findBySlug($slug)) {
            throw (new ModelNotFoundException)->setModel(get_called_class());
        }

        // Return the model if visible
        $item->enforceVisibility();

        return $item;
    }
public static function findBySlugOrFail ( $ slug , array $ columns = [ '*' ] ) { // Model not found, throw exception if ( ! $ item = static :: findBySlug ( $ slug ) ) { throw ( new ModelNotFoundException ) -> setModel ( get_called_class ( ) ) ; } // Return the model if visible $ item -> enforceVisibility ( ) ; return $ item ; }
Find by the slug and fail if missing.  Invokes methods from the
Sluggable trait.

@param  string $string
@param  array $columns
@return Illuminate\Database\Eloquent\Model

@throws Illuminate\Database\Eloquent\ModelNotFoundException
Find by the slug and fail if missing . Invokes methods from the Sluggable trait .