Journal Entry, June 7th to June 14th 2019

June 14, 2019 · 1 min read

Laravel

  1. Mon Jun 10

    • Returning files sorted by creation time.

      $files = collect(\File::files($realDirectory))
          ->filter(function(\SplFileInfo $file) {
              return strpos($file->getFileName(), "{$this->fileName}");
          })->sortBy(function (\SplFileInfo $file) {
              return $file->getCTime();
          }, SORT_NUMERIC)->map(function (\SplFileInfo $file) {
              return [
                  'base' => $file->getBasename(),
                  'name' => $file->getFilename(),
                  'created' => $file->getCTime(),
                  'modified' => $file->getMTime(),
                  'size' => $file->getSize(),
              ];
          });
  2. Fri June 14