Skip to content

Commit

Permalink
First release for Nova v2
Browse files Browse the repository at this point in the history
  • Loading branch information
Krato committed May 3, 2019
1 parent 01ab076 commit 557b9b2
Show file tree
Hide file tree
Showing 2 changed files with 40 additions and 2 deletions.
15 changes: 15 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,10 +16,25 @@ A Filemanager Tool and Field for Laravel Nova
![FileManager Field](https://user-images.githubusercontent.com/42798230/44864362-5f9cd700-ac77-11e8-9e0f-330d18a81598.gif)


### Installation

#### Nova v2

```bash
composer require "infinety-es/nova-filemanager"
```

#### Nova v1

```bash
composer require "infinety-es/nova-filemanager:2.1.*"
```

### Docs

[https://infinetyes.github.io/Nova-Filemanager/](https://infinetyes.github.io/Nova-Filemanager)


### Testing

``` bash
Expand Down
27 changes: 25 additions & 2 deletions src/FilemanagerField.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,11 @@

namespace Infinety\Filemanager;

use Laravel\Nova\Fields\Field;
use Infinety\Filemanager\Http\Services\FileManagerService;
use Laravel\Nova\Contracts\Cover;
use Laravel\Nova\Fields\Field;

class FilemanagerField extends Field
class FilemanagerField extends Field implements Cover
{
/**
* The field's component.
Expand Down Expand Up @@ -109,6 +110,28 @@ public function resolveInfo()
return [];
}

/**
* Resolve the thumbnail URL for the field.
*
* @return string|null
*/
public function resolveThumbnailUrl()
{
if ($this->value) {
$service = new FileManagerService();

$data = $service->getFileInfoAsArray($this->value);

if (empty($data)) {
return null;
}

return $data['url'];
}

return null;
}

/**
* Get additional meta information to merge with the element payload.
*
Expand Down

0 comments on commit 557b9b2

Please sign in to comment.