OwlCyberSecurity - MANAGER
Edit File: StoresExport.php
<?php namespace App\Exports; use App\Models\Store; use Maatwebsite\Excel\Concerns\FromCollection; use Maatwebsite\Excel\Concerns\WithHeadings; class StoresExport implements FromCollection, WithHeadings { /** * @return \Illuminate\Support\Collection */ public function collection() { return Store::selectRaw("stores.id, stores.title, stores.slug, stores.description, stores.long_description, stores.url, stores.destination_url, categories.name as category_name, networks.name as network_name, stores.meta_title, stores.meta_keywords, stores.meta_description, IF(stores.is_featured = 1 , 'Yes' , '') as is_featured, IF(stores.is_top_store = 1 , 'Yes' , '') as is_top_store, IF(stores.status = 1 , 'Active' , 'Inactive') as status_fomated, DATE_FORMAT(stores.created_at,'%d/%m/%Y %h:%i:%s %p') as created_date, DATE_FORMAT(stores.updated_at,'%d/%m/%Y %h:%i:%s %p') as updated_date, a.name as added_by, b.name as updated_by") ->leftjoin('categories', 'categories.id', '=', 'stores.category_id') ->leftjoin('networks', 'networks.id', '=', 'stores.network_id') ->leftjoin('users as a', 'a.id', '=', 'stores.added_by') ->leftjoin('users as b', 'b.id', '=', 'stores.updated_by') ->where('stores.deleted_at', null) ->orderby('id', 'desc') ->get(); } /** * Write code on Method * * @return response() */ public function headings(): array { return ["ID", "Title", "Slug", "Description", "Long Description", "URL", "Destination URL", "Category", "Network", "Meta Title", "Meta Keywords", "Meta Description", "Is Featured", "Is Top Store", "Status", "Created Date", "Updated Date", "Added By", "Updated By"]; } }