I have two tables which I want to join and create an Excel .
event_invoice
columns
id
name
invoice_value
invoice_date
invoice
model
<?php
namespace App;
use Illuminate\Database\Eloquent\Model;
class Invoice extends Model
{
//
protected $table = 'event_invoice';
protected $primaryKey = 'Id';
/*
* An invoice can has many payments
*
*/
public function duedates(){
return $this->hasMany('App\invoiceduedates');
}
}
invoiceduedate columns
id
invoice_id
date
amountin
duedatemodel
<?php
namespace App;
use Illuminate\Database\Eloquent\Model;
class invoiceduedates extends Model
{
protected $table = 'invoiceduedates';
}
So one invoice can have many duedates
I want to display in excel in this format
| name | invoice_value | invoice_date | due date1 | due amount1 | due date2 | due amount2 | due date3 | due amount3 |
|------|---------------|--------------|------------|-------------|------------|-------------|------------|-------------|
| A | 5000 | 30-01-2016 | 15-01-2016 | 2500 | 30-01-2016 | 04-11-1906 | null | null |
| B | 8000 | 02-05-2016 | 15-02-2016 | 8000 | null | null | null | null |
| C | 10000 | 03-05-2016 | 15-05-2016 | 5000 | 19-05-2016 | 2500 | 19-05-2016 | 2500 |
Any help would be appreciated
Thanks
via Chebli Mohamed
Aucun commentaire:
Enregistrer un commentaire