Skip to content

Commit

Permalink
fix: override the media file model for blog
Browse files Browse the repository at this point in the history
  • Loading branch information
tanhongit committed Dec 10, 2024
1 parent b683acf commit 5894c0b
Show file tree
Hide file tree
Showing 3 changed files with 32 additions and 4 deletions.
9 changes: 5 additions & 4 deletions src/Facades/Base/Media/RvMedia.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
namespace CSlant\Blog\Core\Facades\Base\Media;

use Botble\Media\Facades\RvMedia as BaseRvMedia;
use CSlant\Blog\Core\Models\MediaFile;
use Illuminate\Http\JsonResponse;
use Illuminate\Http\Request;
use Illuminate\Http\UploadedFile;
Expand All @@ -21,8 +22,8 @@
* @method static string url(string|null $path)
* @method static string getDefaultImage(bool $relative = false, string|null $size = null)
* @method static string|null getSize(string $name)
* @method static bool deleteFile(\Botble\Media\Models\MediaFile $file)
* @method static bool deleteThumbnails(\Botble\Media\Models\MediaFile $file)
* @method static bool deleteFile(MediaFile $file)
* @method static bool deleteThumbnails(MediaFile $file)
* @method static array getPermissions()
* @method static void setPermissions(array $permissions)
* @method static void removePermission(string $permission)
Expand All @@ -35,7 +36,7 @@
* @method static array handleUpload(UploadedFile|null $fileUpload, string|int|null $folderId = 0, string|null $folderSlug = null, bool $skipValidation = false)
* @method static float getServerConfigMaxUploadFileSize()
* @method static float parseSize(string|int $size)
* @method static bool generateThumbnails(\Botble\Media\Models\MediaFile $file, UploadedFile|null $fileUpload = null)
* @method static bool generateThumbnails(MediaFile $file, UploadedFile|null $fileUpload = null)
* @method static bool insertWatermark(string $image)
* @method static string getRealPath(string|null $url)
* @method static bool isImage(string $mimeType)
Expand Down Expand Up @@ -63,7 +64,7 @@
* @method static void setBunnyCdnDisk(array $config)
* @method static HtmlString image(string|null $url, string|null $alt = null, string|null $size = null, bool $useDefaultImage = true, array $attributes = [], bool|null $secure = null)
* @method static string|null getFileSize(string|null $path)
* @method static void renameFile(\Botble\Media\Models\MediaFile $file, string $newName, bool $renameOnDisk = true)
* @method static void renameFile(MediaFile $file, string $newName, bool $renameOnDisk = true)
* @method static void renameFolder(\Botble\Media\Models\MediaFolder $folder, string $newName, bool $renameOnDisk = true)
* @method static void refreshCache()
* @method static array getFolderColors()
Expand Down
9 changes: 9 additions & 0 deletions src/Models/Base/BaseMediaFile.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
<?php

namespace CSlant\Blog\Core\Models\Base;

use Botble\Media\Models\MediaFile as BotbleMedia;

class BaseMediaFile extends BotbleMedia
{
}
18 changes: 18 additions & 0 deletions src/Models/MediaFile.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
<?php

namespace CSlant\Blog\Core\Models;

use AllowDynamicProperties;
use CSlant\Blog\Core\Models\Base\BaseMediaFile;

/**
* Class Media
*
* @package CSlant\Blog\Core\Models
*
* @mixin BaseMediaFile
*/
#[AllowDynamicProperties]
class MediaFile extends BaseMediaFile
{
}

0 comments on commit 5894c0b

Please sign in to comment.