Server : Apache
System : Linux d13078.sgp1.stableserver.net 5.14.0-611.13.1.el9_7.x86_64 #1 SMP PREEMPT_DYNAMIC Thu Dec 11 04:57:59 EST 2025 x86_64
User : ssa2port ( 1003)
PHP Version : 8.1.34
Disable Function : NONE
Directory :  /home/ssa2port/accounts.trinityturbo.com/app/Exports/

📁 Create New:
⬆️ Upload File:
Current Dir [ Writable ] Root [ Writable ]


OR Upload from URL:
URL: Save as:

📄 File: ProductServiceExport.php

Path: /home/ssa2port/accounts.trinityturbo.com/app/Exports/ProductServiceExport.php

Size: 1.15 KB

Permissions: 0664

<?php

namespace App\Exports;

use App\Models\ProductService;
use Maatwebsite\Excel\Concerns\FromCollection;
use Maatwebsite\Excel\Concerns\WithHeadings;

class ProductServiceExport implements FromCollection, WithHeadings
{

    public function collection()
    {
        $data = ProductService::get();

        foreach ($data as $k => $ProductService) {
            $taxe  = ProductService::Taxe($ProductService->tax_id);
            $unit  = ProductService::productserviceunit($ProductService->unit_id);
            $category  = ProductService::productcategory($ProductService->category_id);


            unset($ProductService->created_by,$ProductService->sku, $ProductService->updated_at, $ProductService->created_at);
            $data[$k]["tax_id"]       = $taxe;
            $data[$k]["unit_id"]       = $unit;
            $data[$k]["category_id"]   = $category;

        }

        return $data;
    }

    public function headings(): array
    {
        return [
            "ID",
            "Name",
            "SKU",
            "Quantity",
            "sale_price",
            "purchase_price",
            "Type",
            "Description",
        ];
    }
}

← Back to Directory Edit File 🔒 Chmod

WP File Manager