From 75a2418601296797f6b8bd4cb49b2d95797df102 Mon Sep 17 00:00:00 2001 From: Caleb Porzio Date: Thu, 12 Aug 2021 09:54:53 -0400 Subject: [PATCH] wip --- README.md | 4 ++-- src/Sushi.php | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/README.md b/README.md index e2e695b..6454d5e 100644 --- a/README.md +++ b/README.md @@ -175,7 +175,7 @@ class Role extends Model By default, Sushi looks at the "last modified" timestamp of your model PHP file and compares it with its internal `.sqlite` cache file. If the model file has been changed more recently than the `.sqlite` cache file, then Sushi will destroy and rebuild the `.sqlite` cache. Additionally, you can configure an external file for Sushi to reference when determining if the cache is up to date or needs to be refreshed. -If, for example, you are using Sushi to provide an Eloquent model for an external data source file like an `.csv` file, you can use `sushiModelPath` to force Sushi to reference the `.csv` file when determining if the cache is stale. +If, for example, you are using Sushi to provide an Eloquent model for an external data source file like an `.csv` file, you can use `sushiCacheReferencePath` to force Sushi to reference the `.csv` file when determining if the cache is stale. For example: @@ -194,7 +194,7 @@ class Role extends Model return true; } - protected function sushiModelPath() + protected function sushiCacheReferencePath() { return __DIR__.'/roles.csv'; } diff --git a/src/Sushi.php b/src/Sushi.php index 2ab7322..8e9ab84 100644 --- a/src/Sushi.php +++ b/src/Sushi.php @@ -21,7 +21,7 @@ public function getSchema() return $this->schema ?? []; } - protected function sushiModelPath() + protected function sushiCacheReferencePath() { return (new \ReflectionClass(static::class))->getFileName(); } @@ -43,7 +43,7 @@ public static function bootSushi() $cacheFileName = config('sushi.cache-prefix', 'sushi').'-'.Str::kebab(str_replace('\\', '', static::class)).'.sqlite'; $cacheDirectory = realpath(config('sushi.cache-path', storage_path('framework/cache'))); $cachePath = $cacheDirectory.'/'.$cacheFileName; - $dataPath = $instance->sushiModelPath(); + $dataPath = $instance->sushiCacheReferencePath(); $states = [ 'cache-file-found-and-up-to-date' => function () use ($cachePath) {