src/Commands/ImportMediaCommand.php
protected function getRecordForFile($path, $existing_media)
    {
        $directory = File::cleanDirname($path);
        $filename = pathinfo($path, PATHINFO_FILENAME);
        $extension = pathinfo($path, PATHINFO_EXTENSION);

        return $existing_media->filter(function (Media $media) use ($directory, $filename, $extension) {
            return $media->directory == $directory && $media->filename == $filename && $media->extension == $extension;
        })->first();
    }
protected function getRecordForFile($path, $existing_media)
    {
        $directory = File::cleanDirname($path);
        $filename = pathinfo($path, PATHINFO_FILENAME);
        $extension = pathinfo($path, PATHINFO_EXTENSION);

        return $existing_media->filter(function (Media $media) use ($directory, $filename, $extension) {
            return $media->directory == $directory && $media->filename == $filename && $media->extension == $extension;
        })->first();
    }
protected function getRecordForFile ( $ path , $ existing_media ) { $ directory = File :: cleanDirname ( $ path ) ; $ filename = pathinfo ( $ path , PATHINFO_FILENAME ) ; $ extension = pathinfo ( $ path , PATHINFO_EXTENSION ) ; return $ existing_media -> filter ( function ( Media $ media ) use ( $ directory , $ filename , $ extension ) { return $ media -> directory == $ directory && $ media -> filename == $ filename && $ media -> extension == $ extension ; } ) -> first ( ) ; }
Search through the record list for one matching the provided path.
@param  string $path
@param  \Illuminate\Database\Eloquent\Collection $existing_media
@return \Plank\Mediable\Media|null
Search through the record list for one matching the provided path .