viralsbackpack / backpackexcel
Import excel has relationship
Requires
- freshbitsweb/laratables: ^1.1
- illuminate/support: ~5
- maatwebsite/excel: ^3.1
Requires (Dev)
- mockery/mockery: ^1.1
- orchestra/testbench: ~3.0
- phpunit/phpunit: ~7.0
- sempro/phpunit-pretty-print: ^1.0
This package is auto-updated.
Last update: 2025-03-07 16:18:16 UTC
README
This is where your description should go. Take a look at contributing.md to see a to do list.
Description
This package support import data from excel with relationship
Installation
Via Composer
$ composer require viralsbackpack/backpackexcel
Run command:
php artisan vendor:publish --provider="ViralsLaravel\ImportRelationExcel\ImportRelationExcelServiceProvider"
php artisan migrate
php artisan storage:link
Setup
_Add trait ViralsLaravel\ImportRelationExcel\Traits\ViralsRelationshipMethod
to model class, Eg:
<?php namespace App\Models; use Illuminate\Database\Eloquent\Model; use Backpack\CRUD\CrudTrait; use ViralsLaravel\ImportRelationExcel\Traits\ViralsRelationshipMethod;// <------------------------------- this one class Tag extends Model { use CrudTrait; use ViralsRelationshipMethod; // <------------------------------- this one /* |-------------------------------------------------------------------------- | GLOBAL VARIABLES |-------------------------------------------------------------------------- */ protected $table = 'tags'; protected $fillable = ['name']; }
_Add attribute $requestExcel to model class if you want validate data import
<?php use App\Http\Requests\TagRequest; class Tag extends Model { public $requestExcel = TagRequest::class; }
_Add sidebar manager log import excel
<li><a href="{{ route('excel-fields.index') }}"><i class="fa fa-files-o"></i> <span>Virals Excels</span></a></li>
_In store method in controller, you call method import excel
$ip = new ViralsLaravel\ImportRelationExcel\HandlExcel\Import(); $ip->processImport($request->file);
Usage:
Change log
Please see the changelog for more information on what has changed recently.
Contributing
Please see contributing.md for details and a todolist.
Security
If you discover any security related issues, please email author email instead of using the issue tracker.
Credits
License
license. Please see the license file for more information.