viralsbackpack/backpackexcel

1.0 2019-05-07 03:24 UTC

This package is auto-updated.

Last update: 2024-04-07 14:20:16 UTC


README

Latest Version on Packagist Total Downloads Build Status StyleCI

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:

_Watch guide video: IMAGE ALT TEXT HERE

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.