Skip to content

Commit

Permalink
config naming fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
lahirulhr committed May 25, 2022
1 parent 0f5cbc7 commit 03aec47
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 16 deletions.
2 changes: 1 addition & 1 deletion dist/js/field.js

Large diffs are not rendered by default.

8 changes: 4 additions & 4 deletions resources/js/components/addons/media/ImagePicker.vue
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,7 @@ export default {
this.$emit('close')
},
getMedia(url = "/nova-vendor/nova-media-tinymce/get-images") {
getMedia(url = "/nova-vendor/nova-image-tinymce/get-images") {
this.imagesIsLoading = true
Nova.request().get(url)
.then(res => {
Expand Down Expand Up @@ -142,7 +142,7 @@ export default {
searchImages() {
this.imagesIsLoading = true
Nova.request().get('/nova-vendor/nova-media-tinymce/search-images/' + this.searchQuery)
Nova.request().get('/nova-vendor/nova-image-tinymce/search-images/' + this.searchQuery)
.then(res => {
this.images = res.data
this.imagesIsLoading = false
Expand All @@ -165,7 +165,7 @@ export default {
}
Nova.request().post('/nova-vendor/nova-media-tinymce/upload-image',formData,{
Nova.request().post('/nova-vendor/nova-image-tinymce/upload-image',formData,{
headers: {
'Content-Type': 'multipart/form-data'
}
Expand Down Expand Up @@ -194,7 +194,7 @@ export default {
this.imagesIsLoading = true
Nova.request().post('/nova-vendor/nova-media-tinymce/delete-images/',{
Nova.request().post('/nova-vendor/nova-image-tinymce/delete-images/',{
images: this.selectedImages.map((itm) => itm.id)
})
.then(res => {
Expand Down
12 changes: 6 additions & 6 deletions src/Controller/MediaController.php
Original file line number Diff line number Diff line change
Expand Up @@ -48,13 +48,13 @@ public function uploadImage(Request $request)
foreach ($request->file('images') as $file){

$fileName = Str::random() . "." . $file->getClientOriginalExtension();
$file->storeAs(Str::finish(config('nova-tinymce5-editor.storage_path'), "/"), $fileName, ['disk' => config('nova-tinymce5-editor.disk')]);
$file->storeAs(Str::finish(config('nova-image-tinymce.storage_path'), "/"), $fileName, ['disk' => config('nova-image-tinymce.disk')]);

$rec = DB::table('tinymce_images')->insertGetId([
'name' => $file->getClientOriginalName(),
'file_name' => $fileName,
'file_size' => $file->getSize(),
'disk' => config('nova-tinymce5-editor.disk'),
'disk' => config('nova-image-tinymce.disk'),
'created_at' => now()
]);

Expand All @@ -81,8 +81,8 @@ public function deleteImages(Request $request)
foreach ($request->get('images') as $img) {
$file = DB::table('tinymce_images')->where('id', $img)->first();
// remove file from storage
Storage::disk(config('nova-tinymce5-editor.disk'))
->delete(config('nova-tinymce5-editor.storage_path') . "/" . $file->file_name);
Storage::disk(config('nova-image-tinymce.disk'))
->delete(config('nova-image-tinymce.storage_path') . "/" . $file->file_name);
// remove db entry
DB::table('tinymce_images')->delete($img);
}
Expand All @@ -103,7 +103,7 @@ private function sizeFilter($bytes)

private function getImageUrl($image)
{
return Storage::disk(config('nova-tinymce5-editor.disk'))
->url(config('nova-tinymce5-editor.storage_path') . $image);
return Storage::disk(config('nova-image-tinymce.disk'))
->url(config('nova-image-tinymce.storage_path') . $image);
}
}
7 changes: 2 additions & 5 deletions src/FieldServiceProvider.php
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,8 @@ public function boot()

// $this->loadRoutesFrom(__DIR__.'/../routes/web.php');

Route::middleware(['nova', Authorize::class])
->prefix('nova-vendor/nova-media-tinymce')
Route::middleware(['nova'])
->prefix('nova-vendor/nova-image-tinymce')
->group(__DIR__.'/../routes/api.php');

Nova::serving(function (ServingNova $event) {
Expand All @@ -33,9 +33,6 @@ public function boot()
__DIR__ . '/../config/nova-image-tinymce.php' => config_path('nova-image-tinymce.php'),
], 'config');

$this->publishes([
__DIR__.'/../database/migrations/2022_01_01_12526_create_tinymce_images_table' => database_path('migrations')
],'migration');
}

/**
Expand Down

0 comments on commit 03aec47

Please sign in to comment.