app/Models/Song.php
/**
     * Scope a query to only include songs in a given directory.
     *
     * @param \Illuminate\Database\Eloquent\Builder $query
     * @param string                                $path  Full path of the directory
     *
     * @return \Illuminate\Database\Eloquent\Builder
     */
Scope a query to only include songs in a given directory.
@param \Illuminate\Database\Eloquent\Builder $query
@param string                                $path  Full path of the directory

@return \Illuminate\Database\Eloquent\Builder
Scope a query to only include songs in a given directory . @param \ Illuminate \ Database \ Eloquent \ Builder $query @param string $path Full path of the directory @return \ Illuminate \ Database \ Eloquent \ Builder
public function scopeInDirectory($query, $path)
    {
        $path = rtrim(trim($path), DIRECTORY_SEPARATOR).DIRECTORY_SEPARATOR;
        return $query->where('path', 'LIKE', "$path%");
    }
public function scopeInDirectory ( $ query , $ path ) { $ path = rtrim ( trim ( $ path ) , DIRECTORY_SEPARATOR ) . DIRECTORY_SEPARATOR ; return $ query -> where ( 'path' , 'LIKE' , " $ path % " ) ; }
Scope a query to only include songs in a given directory.
Scope a query to only include songs in a given directory .
// Make sure the path ends with a directory separator.