定制 laravel-daddy/swift-media 二次开发

按需修改功能、优化性能、对接业务系统,提供一站式技术支持

邮箱:yvsm@zunyunkeji.com | QQ:316430983 | 微信:yvsm316

laravel-daddy/swift-media

最新稳定版本:1.0.0

Composer 安装命令:

composer require laravel-daddy/swift-media

包简介

Easy way to manage multimedia with polymorphic table

README 文档

README

Crafted with ♥️ by Laravel Daddy

Installation

To install the package, run the following command:

composer require laravel-daddy/swift-media
php artisan vendor:publish --tag=migrations

Upon installation, the package will automatically publish the necessary migrations and register the SwiftMediaServiceProvider.

Usage

All media are automatically cached to enhance the performance of your application. This ensures that accessing settings is efficient and optimized.

You can manage settings using either the facade or the helper method.

Using the Facade

use LaravelDaddy\SwiftSettings\Facade\SwiftSettingsFacade;

// will upload file and delete old file if exist
SwiftMedia::uploadFile($model_type= User::class, $model_id= 2, $attribute= 'profile', $file, $path= '/');
SwiftMedia::deleteFile($model_type= User::class, $model_id= 2, $attribute= 'profile');
SwiftMedia::getAllFiles();
SwiftMedia::getAllFilesPaginated($limit = 20);

Using the Helper Method

// will upload file and delete old file if exist
swift_media()->uploadFile($model_type= User::class, $model_id= 2, $attribute= 'profile', $file, $path= '/');
swift_media()->deleteFile($model_type= User::class, $model_id= 2, $attribute= 'profile');
swift_media()->getAllFiles();
swift_media()->getAllFilesPaginated($limit = 20);

Both approaches allow you to retrieve or update media efficiently, with all keys being cached for improved performance.

统计信息

  • 总下载量: 11
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 1
  • 点击次数: 3
  • 依赖项目数: 0
  • 推荐数: 0

GitHub 信息

  • Stars: 0
  • Watchers: 1
  • Forks: 0
  • 开发语言: PHP

其他信息

  • 授权协议: MIT
  • 更新时间: 2024-10-09