src/Manager.php
public function files()
    {
        $files = Collection::make($this->disk->allFiles($this->path))->filter(function ($file) {
            return $this->disk->extension($file) == 'php';
        });

        $filesByFile = $files->groupBy(function ($file) {
            $fileName = $file->getBasename('.'.$file->getExtension());

            if (Str::contains($file->getPath(), 'vendor')) {
                $fileName = str_replace('.php', '', $file->getFileName());

                $packageName = basename(dirname($file->getPath()));

                return "{$packageName}::{$fileName}";
            } else {
                return $fileName;
            }
        })->map(function ($files) {
            return $files->keyBy(function ($file) {
                return basename($file->getPath());
            })->map(function ($file) {
                return $file->getRealPath();
            });
        });

        // If the path does not contain "vendor" then we're looking at the
        // main language files of the application, in this case we will
        // neglect all vendor files.
        if (! Str::contains($this->path, 'vendor')) {
            $filesByFile = $this->neglectVendorFiles($filesByFile);
        }

        return $filesByFile;
    }
public function files()
    {
        $files = Collection::make($this->disk->allFiles($this->path))->filter(function ($file) {
            return $this->disk->extension($file) == 'php';
        });

        $filesByFile = $files->groupBy(function ($file) {
            $fileName = $file->getBasename('.'.$file->getExtension());

            if (Str::contains($file->getPath(), 'vendor')) {
                $fileName = str_replace('.php', '', $file->getFileName());

                $packageName = basename(dirname($file->getPath()));

                return "{$packageName}::{$fileName}";
            } else {
                return $fileName;
            }
        })->map(function ($files) {
            return $files->keyBy(function ($file) {
                return basename($file->getPath());
            })->map(function ($file) {
                return $file->getRealPath();
            });
        });

        // If the path does not contain "vendor" then we're looking at the
        // main language files of the application, in this case we will
        // neglect all vendor files.
        if (! Str::contains($this->path, 'vendor')) {
            $filesByFile = $this->neglectVendorFiles($filesByFile);
        }

        return $filesByFile;
    }
public function files ( ) { $ files = Collection :: make ( $ this -> disk -> allFiles ( $ this -> path ) ) -> filter ( function ( $ file ) { return $ this -> disk -> extension ( $ file ) == 'php' ; } ) ; $ filesByFile = $ files -> groupBy ( function ( $ file ) { $ fileName = $ file -> getBasename ( '.' . $ file -> getExtension ( ) ) ; if ( Str :: contains ( $ file -> getPath ( ) , 'vendor' ) ) { $ fileName = str_replace ( '.php' , '' , $ file -> getFileName ( ) ) ; $ packageName = basename ( dirname ( $ file -> getPath ( ) ) ) ; return "{$packageName}::{$fileName}" ; } else { return $ fileName ; } } ) -> map ( function ( $ files ) { return $ files -> keyBy ( function ( $ file ) { return basename ( $ file -> getPath ( ) ) ; } ) -> map ( function ( $ file ) { return $ file -> getRealPath ( ) ; } ) ; } ) ; // If the path does not contain "vendor" then we're looking at the // main language files of the application, in this case we will // neglect all vendor files. if ( ! Str :: contains ( $ this -> path , 'vendor' ) ) { $ filesByFile = $ this -> neglectVendorFiles ( $ filesByFile ) ; } return $ filesByFile ; }
Array of language files grouped by file name.

ex: ['user' => ['en' => 'user.php', 'nl' => 'user.php']]

@return array
Array of language files grouped by file name .