s-patompong/nova-import
Composer 安装命令:
composer require s-patompong/nova-import
包简介
A Laravel Nova import tool.
README 文档
README
💡 Suggestion: Nova v3.10.0+ has ability to create "standalone" actions for running actions without selecting resources. you can create import action without using this package. Tutorial
Import data to resources.
Installation
You can install the package in to a Laravel app that uses Nova via composer:
composer require anaseqal/nova-import
Register the tool in your app/Providers/NovaServiceProvider.php:
use Anaseqal\NovaImport\NovaImport; // ... public function tools() { return [ new NovaImport, // ... ]; }
Usage
To use this tool, you need to create two things:
-
Create an import class for your resource using Laravel Excel.
-
Create a custom Nova Action file:
<?php namespace App\Nova\Actions; use Illuminate\Bus\Queueable; use Anaseqal\NovaImport\Actions\Action; use Illuminate\Support\Collection; use Laravel\Nova\Fields\ActionFields; use Illuminate\Queue\SerializesModels; use Illuminate\Queue\InteractsWithQueue; use Illuminate\Contracts\Queue\ShouldQueue; use Laravel\Nova\Fields\File; use App\Imports\UsersImport; use Maatwebsite\Excel\Facades\Excel; class ImportUsers extends Action { use InteractsWithQueue, Queueable, SerializesModels; /** * Indicates if this action is only available on the resource detail view. * * @var bool */ public $onlyOnIndex = true; /** * Get the displayable name of the action. * * @return string */ public function name() { return __('Import Users'); } /** * @return string */ public function uriKey() :string { return 'import-users'; } /** * Perform the action. * * @param \Laravel\Nova\Fields\ActionFields $fields * @return mixed */ public function handle(ActionFields $fields) { Excel::import(new UsersImport, $fields->file); return Action::message('It worked!'); } /** * Get the fields available on the action. * * @return array */ public function fields() { return [ File::make('File') ->rules('required'), ]; } }
- Register the action into your resource:
/** * Get the actions available for the resource. * * @param \Illuminate\Http\Request $request * @return array */ public function actions(Request $request) { return [new Actions\ImportUsers]; }
Action Name must use the Format of Import{ResourceName}, for example ImportUsers or ImportCountries.
Please note that it extends Anaseqal\NovaImport\Actions\Action not normal Nova Actions because it doesn't applies on models!
License
The MIT License (MIT). Please see License File for more information.
s-patompong/nova-import 适用场景与选型建议
s-patompong/nova-import 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 38 次下载、GitHub Stars 达 0, 最近一次更新时间为 2024 年 02 月 21 日, 在 PHP 生态内属于活跃度较高的组件。
它主要适用于以下技术方向: 「import」 「nova」 「laravel」 等业务场景。在实际项目中,围绕这些方向常见需要落地的问题包括:接口对接、性能调优、并发安全、与既有框架(Laravel / ThinkPHP / Yii / Webman 等)的兼容适配,以及生产环境的日志埋点与稳定性保障。
我们在过去多个企业项目中使用过 s-patompong/nova-import 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。
基于 s-patompong/nova-import 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。
线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。
承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。
与 s-patompong/nova-import 相关的其它包
同方向 / 同关键字的高下载量 PHP Composer 包推荐,方便对比选型:
A Laravel Nova card that shows you your system information.
A Laravel Nova card.
A Laravel Nova package for publishable fields
A Laravel Nova package for translatable fields
Parse use statements for a reflection object
Tool for copying data from a production database to a dev database. Also useful for making backups of production databases.
统计信息
- 总下载量: 38
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 0
- 点击次数: 6
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2024-02-21