From the tutorial you need to create an export class
php artisan make:export ReportExport --model=ReportModel
In the collectionmethod of ReportExport class you return your eloquent query
public function collection() {
return ReportModel::leftJoin('tb_m_biller_solusi', function($join){
$join->on('tb_r_solusiorder.productid', '=', 'tb_m_biller_solusi.Productid');
$join->on('tb_r_solusiorder.billerid', '=', 'tb_m_biller_solusi.Billerid');
})
->leftJoin('tb_m_biller', 'tb_r_solusiorder.billerid', '=', 'tb_m_biller.biller_id')
->get();
}
The within your controller you would
use App\Exports\ReportExport;
use Maatwebsite\Excel\Facades\Excel;
use App\Http\Controllers\Controller;
class ReportController extends Controller
{
public function export()
{
return Excel::download(new ReportExport, 'report.xlsx');
}
}
You will need a route to call the export method
Route::get('/create-report', 'ReportController@export');
If access this route in your browser it should download your report.