-
-
Notifications
You must be signed in to change notification settings - Fork 30
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Create custom PasswordExposedChecker object and set cache directory t…
…o Laravel storage path
- Loading branch information
1 parent
0d27754
commit 1e5adb7
Showing
2 changed files
with
56 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
<?php | ||
|
||
namespace DivineOmega\LaravelPasswordExposedValidationRule\Factories; | ||
|
||
use DivineOmega\DOFileCachePSR6\CacheItemPool; | ||
use DivineOmega\PasswordExposed\PasswordExposedChecker; | ||
|
||
/** | ||
* Class PasswordExposedCheckerFactory | ||
* @package DivineOmega\LaravelPasswordExposedValidationRule\Factories | ||
*/ | ||
class PasswordExposedCheckerFactory | ||
{ | ||
/** | ||
* Creates and returns an instance of PasswordExposedChecker. | ||
* | ||
* @return PasswordExposedChecker | ||
*/ | ||
public function instance() | ||
{ | ||
$cache = new CacheItemPool(); | ||
|
||
$cache->changeConfig([ | ||
'cacheDirectory' => $this->getCacheDirectory(), | ||
]); | ||
|
||
return new PasswordExposedChecker(null, $cache); | ||
} | ||
|
||
/** | ||
* Gets the directory to store the cache files. | ||
* | ||
* @return string | ||
*/ | ||
private function getCacheDirectory() | ||
{ | ||
return storage_path('password-exposed-cache/'); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters