Skip to content

Commit 0f45c94

Browse files
committed
edit ValidateFiles Tratis
1 parent 20c0a1b commit 0f45c94

File tree

2 files changed

+6
-3
lines changed

2 files changed

+6
-3
lines changed

src/Toolkit.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,8 @@ public static function makeEmptyHelper($name)
3131
if (!File::isDirectory($path = (new self)->getHelperDirectory()))
3232
mkdir($path, 0777, true);
3333

34+
dd((new self)->ensureHelperDoesntAlreadytExist($name));
35+
3436
$template = (new self)->getEmptyHelperStub();
3537

3638
file_put_contents((new self)->getHelperFilePath($name), $template);

src/Traits/validateModel.php

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,15 +2,16 @@
22

33
namespace Miladimos\Toolkit\Traits;
44

5-
use InvalidArgumentException;
65

76
trait ValidateModel
87
{
98

109
protected function ensureHelperDoesntAlreadytExist($file)
1110
{
12-
if (file_exists($this->getHelperPath($file), false)) {
13-
throw new InvalidArgumentException("{$file} already exists.");
11+
if (!file_exists($this->getHelperFilePath($file))) {
12+
return false;
1413
}
14+
15+
return true;
1516
}
1617
}

0 commit comments

Comments
 (0)