定制 nova-kit/nova-on-vapor 二次开发

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

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

nova-kit/nova-on-vapor

最新稳定版本:v2.1.0

Composer 安装命令:

composer require nova-kit/nova-on-vapor

包简介

Nova on Vapor Integration Library

README 文档

README

tests Latest Stable Version Total Downloads Latest Unstable Version License

This library attempts to solves several limitations when using Laravel Nova on Laravel Vapor including:

  • Unable to use interactive mode on Artisan affecting nova:user command.
  • Ability to use VaporFile and VaporImage locally via Minio.
  • ExportAsCsv supports for Laravel Vapor

Installation

To install through composer, run the following command from terminal:

composer require "nova-kit/nova-on-vapor"

Usages

New nova:vapor-user Command

The command swaps interactive mode questions to artisan command options, so you can use --email, --name and optionally --password, as an example:

php artisan nova:vapor-user --name="Administrator" --email="nova@laravel.com"

Note: Without passing --password, the code would generate a random 8 character password and you can use the Forgot Password feature to reset the value.

Warning: Using --password is possible but be aware that the value will be logged to CloudWatch.

Minio for VaporFile and VaporImage locally

You can setup Minio locally and use it as a replacement for S3 locally. First you need to install league/flysystem-aws-s3-v3 by running the following command:

composer require "league/flysystem-aws-s3-v3"

Next, you need to enable and configure Minio:

NOVA_ON_VAPOR_ENABLES_MINIO=(true)

MINIO_USERNAME=
MINIO_PASSWORD=
MINIO_ENDPOINT=

AWS_ACCESS_KEY_ID="${MINIO_USERNAME}"
AWS_SECRET_ACCESS_KEY="${MINIO_PASSWORD}"
AWS_DEFAULT_REGION=us-east-1
AWS_BUCKET=local
AWS_ENDPOINT="${MINIO_ENDPOINT}"
AWS_USE_PATH_STYLE_ENDPOINT=(true)

CSV Export

You can replace Laravel\Nova\Actions\ExportAsCsv with NovaKit\NovaOnVapor\Actions\VaporExportAsCsv:

use Laravel\Nova\Actions\ExportAsCsv;
use NovaKit\NovaOnVapor\Actions\VaporExportAsCsv;

/**
 * Get the actions available for the resource.
 *
 * @param  \Laravel\Nova\Http\Requests\NovaRequest  $request
 * @return array
 */
public function actions(NovaRequest $request)
{
    return [
        VaporExportAsCsv::make(),
    ];
}

If you would like to change the storage disk to store the CSV file that is available for download, you may invoke the withStorageDisk() method when registering the action:

return [
    VaporExportAsCsv::make()->withStorageDisk('s3'),
];

downloadViaTemporaryUrl Mixin

Laravel Vapor has a response limit of 6MB and this would cause issue when you need to download large files. You can avoid this by utilising Storage::temporaryUrl() to download the file:

VaporFile::make('Filename')->downloadViaTemporaryUrl(),

统计信息

  • 总下载量: 49.86k
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 6
  • 点击次数: 2
  • 依赖项目数: 0
  • 推荐数: 0

GitHub 信息

  • Stars: 6
  • Watchers: 2
  • Forks: 0
  • 开发语言: PHP

其他信息

  • 授权协议: MIT
  • 更新时间: 2022-07-10