Skip to content

Commit

Permalink
Add Inline URL to array
Browse files Browse the repository at this point in the history
  • Loading branch information
gabsource committed Apr 4, 2020
1 parent a5099b8 commit 5465cb7
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 9 deletions.
2 changes: 1 addition & 1 deletion config/attachments.php
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@
*/
'attributes' => ['title', 'description', 'key', 'disk', 'filepath', 'group'],

'dropzone_attributes' => ['uuid', 'url', 'filename', 'filetype', 'filesize', 'title', 'description', 'key', 'group'],
'dropzone_attributes' => ['uuid', 'url', 'url_inline', 'filename', 'filetype', 'filesize', 'title', 'description', 'key', 'group'],

/*
|--------------------------------------------------------------------------
Expand Down
20 changes: 12 additions & 8 deletions src/Attachment.php
Original file line number Diff line number Diff line change
Expand Up @@ -19,19 +19,20 @@
* @property int model_id
* @property string model_type
* @property string disk
* @property string filepath the full path on storage disk
* @property string filepath the full path on storage disk
* @property string filename
* @property string filetype
* @property int filesize
* @property string key must be unique across a model's attachments pool
* @property string group allows to group attachments
* @property string key must be unique across a model's attachments pool
* @property string group allows to group attachments
* @property string title
* @property string description
* @property string preview_url
* @property array metadata
* @property string extension the file extension (read-only mutator)
* @property string path the file directory (read-only mutator)
* @property string url the public URL (read-only mutator)
* @property string extension the file extension (read-only mutator)
* @property string path the file directory (read-only mutator)
* @property string url the public URL (read-only mutator)
* @property string url_inline the public URL with inline switch (read-only mutator)
*
* @package Bnb\Laravel\Attachments
*/
Expand Down Expand Up @@ -191,7 +192,7 @@ public function model()
/**
* Register an outputting model event with the dispatcher.
*
* @param \Closure|string $callback
* @param \Closure|string $callback
*
* @return void
*/
Expand Down Expand Up @@ -282,6 +283,7 @@ public function getUrlAttribute()
}
}


public function getUrlInlineAttribute()
{
if ($this->isLocalStorage()) {
Expand All @@ -305,7 +307,8 @@ public function toArray()
$attributes = parent::toArray();

return array_merge($attributes, [
'url' => $this->url
'url' => $this->url,
'url_inline' => $this->url_inline,
]);
}

Expand Down Expand Up @@ -585,6 +588,7 @@ protected function storageCommand($string, $filepath)
return forward_static_call_array([$interface, $command], $args);
}


public function getConnectionName()
{
return config('attachments.database.connection') ?? $this->connection;
Expand Down

0 comments on commit 5465cb7

Please sign in to comment.