Skip to content

Commit

Permalink
added new publicPath method in trait & contract
Browse files Browse the repository at this point in the history
  • Loading branch information
gandesc committed Jun 10, 2020
1 parent dc67b2e commit 5203c6a
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 0 deletions.
2 changes: 2 additions & 0 deletions src/App/Contracts/Attachable.php
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,8 @@ public function attach(File $file, string $originalName, ?User $user): void;

public function folder(): string;

public function publicPath(): ?string;

public function mimeTypes(): array;

public function extensions(): array;
Expand Down
7 changes: 7 additions & 0 deletions src/App/Traits/HasFile.php
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,13 @@ public function folder(): string
return $this->folder;
}

public function publicPath(): ?string
{
return $this->file
? "{$this->folder()}/{$this->file->saved_name}"
: null;
}

public function mimeTypes(): array
{
return property_exists($this, 'mimeTypes')
Expand Down

0 comments on commit 5203c6a

Please sign in to comment.