Plank\Mediable\Commands\ImportMediaCommand::getRecordForFile PHP Метод

getRecordForFile() защищенный Метод

Search through the record list for one matching the provided path.
protected getRecordForFile ( string $path, Illuminate\Database\Eloquent\Collection $existing_media ) : Media | null
$path string
$existing_media Illuminate\Database\Eloquent\Collection
Результат Plank\Mediable\Media | null
    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();
    }