Skip to content

Commit

Permalink
Merge pull request #14 from markhuot/alias-asset-source
Browse files Browse the repository at this point in the history
support @alias in Asset::factory()->source('@alias/something.md')
  • Loading branch information
markhuot authored Jan 16, 2024
2 parents 3d5b961 + 8a17e67 commit bfe1808
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion src/factories/Asset.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

namespace markhuot\craftpest\factories;

use craft\helpers\App;
use craft\models\VolumeFolder;
use Illuminate\Support\Collection;
use markhuot\craftpest\test\RefreshesDatabase;
Expand Down Expand Up @@ -92,7 +93,7 @@ public function definition(int $index = 0)

if ($this->source) {
$filename = basename($this->source);
file_put_contents($tempFile, file_get_contents($this->source));
file_put_contents($tempFile, file_get_contents(App::parseEnv($this->source)));
} else {
$filename = 'asset'.mt_rand(1000, 9999).'.jpg';
file_put_contents($tempFile, file_get_contents(__DIR__.'/../../stubs/images/gray.jpg'));
Expand Down

0 comments on commit bfe1808

Please sign in to comment.