Skip to content
This repository has been archived by the owner on Apr 8, 2024. It is now read-only.

Commit

Permalink
Change name
Browse files Browse the repository at this point in the history
  • Loading branch information
jameslkingsley committed Aug 30, 2018
1 parent baefbec commit 6af997e
Show file tree
Hide file tree
Showing 5 changed files with 18 additions and 18 deletions.
4 changes: 2 additions & 2 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,13 +11,13 @@
},
"autoload": {
"psr-4": {
"Kingsley\\MediaLibraryImage\\": "src/"
"Kingsley\\MediaLibraryField\\": "src/"
}
},
"extra": {
"laravel": {
"providers": [
"Kingsley\\MediaLibraryImage\\MediaLibraryImageServiceProvider"
"Kingsley\\MediaLibraryField\\MediaLibraryFieldServiceProvider"
]
}
},
Expand Down
2 changes: 1 addition & 1 deletion dist/js/field.js

Large diffs are not rendered by default.

6 changes: 3 additions & 3 deletions resources/js/field.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
Nova.booting((Vue, router) => {
Vue.component('index-media-library-image', require('./components/IndexField'));
Vue.component('detail-media-library-image', require('./components/DetailField'));
Vue.component('form-media-library-image', require('./components/FormField'));
Vue.component('index-media-library-field', require('./components/IndexField'));
Vue.component('detail-media-library-field', require('./components/DetailField'));
Vue.component('form-media-library-field', require('./components/FormField'));
})
16 changes: 8 additions & 8 deletions src/MediaLibraryImage.php → src/MediaLibraryField.php
Original file line number Diff line number Diff line change
@@ -1,18 +1,18 @@
<?php

namespace Kingsley\MediaLibraryImage;
namespace Kingsley\MediaLibraryField;

use Laravel\Nova\Fields\Field;
use Laravel\Nova\Http\Requests\NovaRequest;

class MediaLibraryImage extends Field
class MediaLibraryField extends Field
{
/**
* The field's component.
*
* @var string
*/
public $component = 'media-library-image';
public $component = 'media-library-field';

/**
* Hydrate the given attribute on the model based on the incoming request.
Expand Down Expand Up @@ -49,12 +49,12 @@ protected function fillAttributeFromRequest(NovaRequest $request, $requestAttrib
*/
protected function resolveAttribute($resource, $attribute)
{
return url(
$resource->getFirstMediaUrl(
$this->meta()['ml_toMediaCollection'][0],
$this->meta()['usingConversion']
)
$media = $resource->getFirstMediaUrl(
$this->meta()['ml_toMediaCollection'][0],
$this->meta()['usingConversion']
);

return $media ? url($media) : null;
}

/**
Expand Down
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
<?php

namespace Kingsley\MediaLibraryImage;
namespace Kingsley\MediaLibraryField;

use Laravel\Nova\Nova;
use Laravel\Nova\Events\ServingNova;
use Illuminate\Support\ServiceProvider;

class MediaLibraryImageServiceProvider extends ServiceProvider
class MediaLibraryFieldServiceProvider extends ServiceProvider
{
/**
* Bootstrap any application services.
Expand All @@ -16,8 +16,8 @@ class MediaLibraryImageServiceProvider extends ServiceProvider
public function boot()
{
Nova::serving(function (ServingNova $event) {
Nova::script('media-library-image', __DIR__.'/../dist/js/field.js');
Nova::style('media-library-image', __DIR__.'/../dist/css/field.css');
Nova::script('media-library-field', __DIR__.'/../dist/js/field.js');
Nova::style('media-library-field', __DIR__.'/../dist/css/field.css');
});
}

Expand Down

0 comments on commit 6af997e

Please sign in to comment.