Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Multiple Sheets not working if any/all sheet implements FromView #1584

Closed
2 of 3 tasks
dr3ads opened this issue Mar 26, 2018 · 3 comments
Closed
2 of 3 tasks

Multiple Sheets not working if any/all sheet implements FromView #1584

dr3ads opened this issue Mar 26, 2018 · 3 comments
Assignees
Labels

Comments

@dr3ads
Copy link

dr3ads commented Mar 26, 2018

Prerequisites

  • Able to reproduce the behaviour outside of your code, the problem is isolated to Laravel Excel.
  • Checked that your issue isn't already filed.
  • Checked if no PR was submitted that fixes this problem.

Versions

  • PHP version: 7.2
  • Laravel version: 5.5
  • Package version: 3.0.1

Description

Multiple Sheets not working if any/all sheets are FromView

  • all sheets implementing FromView (not working)
  • 1 sheet FromView and another implementing FromCollection (not working)
  • all sheets not implementing FromView (working fine)

Steps to Reproduce (attaching my codes)

`
class FormatReportExport implements WithMultipleSheets, Responsable
{
use Exportable;

protected $reports;
protected $summary;

public function __construct($summary, $reports)
{
    $this->summary = $summary;
    $this->reports = $reports;
}

public function sheets(): array
{
    $sheets = [];

    $sheets[] = new ReportSummaryExport($this->summary);
    $sheets[] = new ReportExport($this->reports);
    
    return $sheets;
}

}
`

`
class ReportSummaryExport implements FromCollection, WithTitle
{
protected $summary;

public function __construct($summary)
{
    $this->summary = $summary;
}


public function collection()
{
    return User::get();
}

/**
 * @return string
 */
public function title(): string
{
    return 'Summary';
}

}`

`class ReportExport implements FromView, WithTitle
{
protected $reports;

public function __construct($reports)
{
    $this->reports = $reports;
}

public function view(): View
{
    return view('export.report.list', [
        'title' => $this->title(),
        'reports' => $this->reports
    ]);
}

/**
 * @return string
 */
public function title(): string
{
    return 'Checklists';
}

}`

list.blade.php
`@extends('layouts.export', ['title' => $title])

@section('content')

@foreach($reports as $report) @Endforeach
Date Created
{{ $report['created_at'] }}

@endsection`

Expected behavior:

Excel file with multiple sheets based on the views.

Actual behavior:

image

@JeroenVossen JeroenVossen self-assigned this Mar 26, 2018
@JeroenVossen
Copy link
Contributor

Thanks for submitting the ticket. We will pick it up as soon as we have resources available (as stated in our support guidelines (https://laravel-excel.maatwebsite.nl/docs/3.0/getting-started/support)).

@patrickbrouwers
Copy link
Member

Will most likely be solved by #1590

@patrickbrouwers
Copy link
Member

https://github.com/Maatwebsite/Laravel-Excel/releases/tag/3.0.2

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants