В моем проекте Laravel я использую Maatwebsite \ Excel для экспорта данных в формате Excel. я использую новую версию 3.0 (Maatwebsite \ Excel)
App / Exports.php
namespace App\Exports;
use App\Purchasepaymenttransaction;
use Illuminate\Contracts\View\View;
use Maatwebsite\Excel\Concerns\FromView;
class InvoicesExport implements FromView
{
public function view(): View
{
$purchasepayment=Purchasepaymenttransaction::Where('transaction_category',2)->OrderBy('transaction_date','DESC')->get();
return view('exports.purchasepayments', [
'purchasepayment' => $purchasepayment
]);
}
}
В моем контроллере платежей
<?php
namespace App\Http\Controllers;
use DB;
use Illuminate\Support\Facades\Hash;
use Illuminate\Support\Facades\Auth;
use Illuminate\Http\Request;
use App\Purchasepaymenttransaction;
use Excel;
use App\Exports;
class PaymentController extends Controller
{
public function purchaseexport()
{
return Excel::download(new InvoicesExport, 'invoices.xlsx');
}
}
я получил сообщение «Class 'App \ Http \ Controllers \ InvoicesExport' не найден»