Skip to content

Commit 5465cb7

Browse files
committed
Add Inline URL to array
1 parent a5099b8 commit 5465cb7

File tree

2 files changed

+13
-9
lines changed

2 files changed

+13
-9
lines changed

config/attachments.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,7 @@
7070
*/
7171
'attributes' => ['title', 'description', 'key', 'disk', 'filepath', 'group'],
7272

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

7575
/*
7676
|--------------------------------------------------------------------------

src/Attachment.php

Lines changed: 12 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -19,19 +19,20 @@
1919
* @property int model_id
2020
* @property string model_type
2121
* @property string disk
22-
* @property string filepath the full path on storage disk
22+
* @property string filepath the full path on storage disk
2323
* @property string filename
2424
* @property string filetype
2525
* @property int filesize
26-
* @property string key must be unique across a model's attachments pool
27-
* @property string group allows to group attachments
26+
* @property string key must be unique across a model's attachments pool
27+
* @property string group allows to group attachments
2828
* @property string title
2929
* @property string description
3030
* @property string preview_url
3131
* @property array metadata
32-
* @property string extension the file extension (read-only mutator)
33-
* @property string path the file directory (read-only mutator)
34-
* @property string url the public URL (read-only mutator)
32+
* @property string extension the file extension (read-only mutator)
33+
* @property string path the file directory (read-only mutator)
34+
* @property string url the public URL (read-only mutator)
35+
* @property string url_inline the public URL with inline switch (read-only mutator)
3536
*
3637
* @package Bnb\Laravel\Attachments
3738
*/
@@ -191,7 +192,7 @@ public function model()
191192
/**
192193
* Register an outputting model event with the dispatcher.
193194
*
194-
* @param \Closure|string $callback
195+
* @param \Closure|string $callback
195196
*
196197
* @return void
197198
*/
@@ -282,6 +283,7 @@ public function getUrlAttribute()
282283
}
283284
}
284285

286+
285287
public function getUrlInlineAttribute()
286288
{
287289
if ($this->isLocalStorage()) {
@@ -305,7 +307,8 @@ public function toArray()
305307
$attributes = parent::toArray();
306308

307309
return array_merge($attributes, [
308-
'url' => $this->url
310+
'url' => $this->url,
311+
'url_inline' => $this->url_inline,
309312
]);
310313
}
311314

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

591+
588592
public function getConnectionName()
589593
{
590594
return config('attachments.database.connection') ?? $this->connection;

0 commit comments

Comments
 (0)