Initial commit
This commit is contained in:
73
app/Exports/ContactsExport.php
Normal file
73
app/Exports/ContactsExport.php
Normal file
@@ -0,0 +1,73 @@
|
||||
<?php
|
||||
|
||||
namespace App\Exports;
|
||||
|
||||
use Illuminate\Support\Collection;
|
||||
use Maatwebsite\Excel\Concerns\Exportable;
|
||||
use Maatwebsite\Excel\Concerns\FromCollection;
|
||||
use Maatwebsite\Excel\Concerns\WithHeadings;
|
||||
use Maatwebsite\Excel\Concerns\WithMapping;
|
||||
use Maatwebsite\Excel\Concerns\WithTitle;
|
||||
|
||||
class ContactsExport implements FromCollection, WithTitle, WithHeadings, WithMapping
|
||||
{
|
||||
use Exportable;
|
||||
|
||||
protected $data;
|
||||
|
||||
public function __construct(Collection $data)
|
||||
{
|
||||
$this->data = $data;
|
||||
}
|
||||
|
||||
public function collection()
|
||||
{
|
||||
return $this->data;
|
||||
}
|
||||
|
||||
|
||||
public function headings(): array
|
||||
{
|
||||
return [
|
||||
__('Profile ID'),
|
||||
__('Profile type'),
|
||||
__('Name'),
|
||||
__('Full name'),
|
||||
__('Location'),
|
||||
__('Last interaction'),
|
||||
__('Has star'),
|
||||
__('Has bookmark'),
|
||||
__('Has transaction'),
|
||||
__('Has conversation'),
|
||||
__('Star count'),
|
||||
__('Bookmark count'),
|
||||
__('Transaction count'),
|
||||
__('Message count'),
|
||||
];
|
||||
}
|
||||
|
||||
public function map($contact): array
|
||||
{
|
||||
return [
|
||||
$contact['profile_id'],
|
||||
__($contact['profile_type_name']),
|
||||
$contact['name'],
|
||||
$contact['full_name'] ?? '',
|
||||
$contact['location'] ?? '',
|
||||
$contact['last_interaction'] ?? '',
|
||||
$contact['has_star'] ? __('Yes') : __('No'),
|
||||
$contact['has_bookmark'] ? __('Yes') : __('No'),
|
||||
$contact['has_transaction'] ? __('Yes') : __('No'),
|
||||
$contact['has_conversation'] ? __('Yes') : __('No'),
|
||||
$contact['star_count'] ?? 0,
|
||||
$contact['bookmark_count'] ?? 0,
|
||||
$contact['transaction_count'] ?? 0,
|
||||
$contact['message_count'] ?? 0,
|
||||
];
|
||||
}
|
||||
|
||||
public function title(): string
|
||||
{
|
||||
return __('Contacts');
|
||||
}
|
||||
}
|
||||
70
app/Exports/ProfileContactsExport.php
Normal file
70
app/Exports/ProfileContactsExport.php
Normal file
@@ -0,0 +1,70 @@
|
||||
<?php
|
||||
|
||||
namespace App\Exports;
|
||||
|
||||
use Illuminate\Support\Collection;
|
||||
use Maatwebsite\Excel\Concerns\Exportable;
|
||||
use Maatwebsite\Excel\Concerns\FromCollection;
|
||||
use Maatwebsite\Excel\Concerns\WithHeadings;
|
||||
use Maatwebsite\Excel\Concerns\WithMapping;
|
||||
use Maatwebsite\Excel\Concerns\WithTitle;
|
||||
|
||||
class ProfileContactsExport implements FromCollection, WithTitle, WithHeadings, WithMapping
|
||||
{
|
||||
use Exportable;
|
||||
|
||||
protected $data;
|
||||
|
||||
public function __construct(Collection $data)
|
||||
{
|
||||
$this->data = $data;
|
||||
}
|
||||
|
||||
public function collection()
|
||||
{
|
||||
return $this->data;
|
||||
}
|
||||
|
||||
public function headings(): array
|
||||
{
|
||||
return [
|
||||
__('Name'),
|
||||
__('Full name'),
|
||||
__('Profile type'),
|
||||
__('Location'),
|
||||
__('Has star'),
|
||||
__('Has bookmark'),
|
||||
__('Has transaction'),
|
||||
__('Has conversation'),
|
||||
__('Star count'),
|
||||
__('Bookmark count'),
|
||||
__('Transaction count'),
|
||||
__('Message count'),
|
||||
__('Last interaction'),
|
||||
];
|
||||
}
|
||||
|
||||
public function map($contact): array
|
||||
{
|
||||
return [
|
||||
$contact['name'] ?? '',
|
||||
$contact['full_name'] ?? '',
|
||||
$contact['profile_type_name'] ?? '',
|
||||
$contact['location'] ?? '',
|
||||
$contact['has_star'] ? __('Yes') : __('No'),
|
||||
$contact['has_bookmark'] ? __('Yes') : __('No'),
|
||||
$contact['has_transaction'] ? __('Yes') : __('No'),
|
||||
$contact['has_conversation'] ? __('Yes') : __('No'),
|
||||
$contact['star_count'] ?? 0,
|
||||
$contact['bookmark_count'] ?? 0,
|
||||
$contact['transaction_count'] ?? 0,
|
||||
$contact['message_count'] ?? 0,
|
||||
$contact['last_interaction'] ?? '',
|
||||
];
|
||||
}
|
||||
|
||||
public function title(): string
|
||||
{
|
||||
return __('Contacts');
|
||||
}
|
||||
}
|
||||
82
app/Exports/ProfileDataExport.php
Normal file
82
app/Exports/ProfileDataExport.php
Normal file
@@ -0,0 +1,82 @@
|
||||
<?php
|
||||
|
||||
namespace App\Exports;
|
||||
|
||||
use Illuminate\Support\Collection;
|
||||
use Maatwebsite\Excel\Concerns\Exportable;
|
||||
use Maatwebsite\Excel\Concerns\FromCollection;
|
||||
use Maatwebsite\Excel\Concerns\WithHeadings;
|
||||
use Maatwebsite\Excel\Concerns\WithMapping;
|
||||
use Maatwebsite\Excel\Concerns\WithTitle;
|
||||
|
||||
class ProfileDataExport implements FromCollection, WithTitle, WithHeadings, WithMapping
|
||||
{
|
||||
use Exportable;
|
||||
|
||||
protected $data;
|
||||
protected $profileType;
|
||||
|
||||
public function __construct(Collection $data, string $profileType)
|
||||
{
|
||||
$this->data = $data;
|
||||
$this->profileType = $profileType;
|
||||
}
|
||||
|
||||
public function collection()
|
||||
{
|
||||
return $this->data;
|
||||
}
|
||||
|
||||
public function headings(): array
|
||||
{
|
||||
$commonHeadings = [
|
||||
__('Name'),
|
||||
__('Full name'),
|
||||
__('Email'),
|
||||
__('About'),
|
||||
__('About short'),
|
||||
__('Motivation'),
|
||||
__('Website'),
|
||||
__('Phone'),
|
||||
str_replace('@PLATFORM_NAME@', platform_name(), __('Visible for registered @PLATFORM_NAME@ users')),
|
||||
__('Location'),
|
||||
__('Social media'),
|
||||
__('Profile photo'),
|
||||
__('Language preference'),
|
||||
__('Created at'),
|
||||
__('Updated at'),
|
||||
__('Last login'),
|
||||
__('Last login') . ' ' . 'IP',
|
||||
];
|
||||
|
||||
return $commonHeadings;
|
||||
}
|
||||
|
||||
public function map($profile): array
|
||||
{
|
||||
return [
|
||||
$profile['name'] ?? '',
|
||||
$profile['full_name'] ?? '',
|
||||
$profile['email'] ?? '',
|
||||
$profile['about'] ?? '',
|
||||
$profile['about_short'] ?? '',
|
||||
$profile['motivation'] ?? '',
|
||||
$profile['website'] ?? '',
|
||||
$profile['phone'] ?? '',
|
||||
$profile['phone_public'] ? __('Yes') : __('No'),
|
||||
$profile['location_first'] ?? '',
|
||||
$profile['social_media'] ?? '',
|
||||
$profile['profile_photo_path'] ?? '',
|
||||
$profile['lang_preference'] ?? '',
|
||||
$profile['created_at'] ?? '',
|
||||
$profile['updated_at'] ?? '',
|
||||
$profile['last_login_at'] ?? '',
|
||||
$profile['last_login_ip'] ?? '',
|
||||
];
|
||||
}
|
||||
|
||||
public function title(): string
|
||||
{
|
||||
return __('Profile data');
|
||||
}
|
||||
}
|
||||
63
app/Exports/ProfileMessagesExport.php
Normal file
63
app/Exports/ProfileMessagesExport.php
Normal file
@@ -0,0 +1,63 @@
|
||||
<?php
|
||||
|
||||
namespace App\Exports;
|
||||
|
||||
use Illuminate\Support\Collection;
|
||||
use Maatwebsite\Excel\Concerns\Exportable;
|
||||
use Maatwebsite\Excel\Concerns\FromCollection;
|
||||
use Maatwebsite\Excel\Concerns\WithHeadings;
|
||||
use Maatwebsite\Excel\Concerns\WithMapping;
|
||||
use Maatwebsite\Excel\Concerns\WithTitle;
|
||||
|
||||
class ProfileMessagesExport implements FromCollection, WithTitle, WithHeadings, WithMapping
|
||||
{
|
||||
use Exportable;
|
||||
|
||||
protected $data;
|
||||
|
||||
public function __construct(Collection $data)
|
||||
{
|
||||
$this->data = $data;
|
||||
}
|
||||
|
||||
public function collection()
|
||||
{
|
||||
return $this->data;
|
||||
}
|
||||
|
||||
public function headings(): array
|
||||
{
|
||||
return [
|
||||
__('Conversation ID'),
|
||||
__('Conversation type'),
|
||||
__('Message ID'),
|
||||
__('Date'),
|
||||
__('Sender name'),
|
||||
__('Sender type'),
|
||||
__('Message'),
|
||||
__('Reply to (ID)'),
|
||||
];
|
||||
}
|
||||
|
||||
public function map($message): array
|
||||
{
|
||||
$conversationType = $message['conversation_type'] ?? '';
|
||||
$conversationType = $conversationType ? __(ucfirst($conversationType)) : '';
|
||||
|
||||
return [
|
||||
$message['conversation_id'],
|
||||
$conversationType,
|
||||
$message['id'],
|
||||
$message['created_at'],
|
||||
$message['sender_name'] ?? '',
|
||||
$message['sender_type'] ?? '',
|
||||
$message['body'],
|
||||
$message['reply_id'] ?? '',
|
||||
];
|
||||
}
|
||||
|
||||
public function title(): string
|
||||
{
|
||||
return __('Messages');
|
||||
}
|
||||
}
|
||||
54
app/Exports/ProfileTagsExport.php
Normal file
54
app/Exports/ProfileTagsExport.php
Normal file
@@ -0,0 +1,54 @@
|
||||
<?php
|
||||
|
||||
namespace App\Exports;
|
||||
|
||||
use Illuminate\Support\Collection;
|
||||
use Maatwebsite\Excel\Concerns\Exportable;
|
||||
use Maatwebsite\Excel\Concerns\FromCollection;
|
||||
use Maatwebsite\Excel\Concerns\WithHeadings;
|
||||
use Maatwebsite\Excel\Concerns\WithMapping;
|
||||
use Maatwebsite\Excel\Concerns\WithTitle;
|
||||
|
||||
class ProfileTagsExport implements FromCollection, WithTitle, WithHeadings, WithMapping
|
||||
{
|
||||
use Exportable;
|
||||
|
||||
protected $data;
|
||||
|
||||
public function __construct(Collection $data)
|
||||
{
|
||||
$this->data = $data;
|
||||
}
|
||||
|
||||
public function collection()
|
||||
{
|
||||
return $this->data;
|
||||
}
|
||||
|
||||
public function headings(): array
|
||||
{
|
||||
return [
|
||||
__('Tag ID'),
|
||||
__('Tag'),
|
||||
__('Category'),
|
||||
__('Category path'),
|
||||
__('Locale'),
|
||||
];
|
||||
}
|
||||
|
||||
public function map($tag): array
|
||||
{
|
||||
return [
|
||||
$tag['tag_id'] ?? '',
|
||||
$tag['tag'] ?? '',
|
||||
$tag['category'] ?? '',
|
||||
$tag['category_path'] ?? '',
|
||||
$tag['locale'] ?? '',
|
||||
];
|
||||
}
|
||||
|
||||
public function title(): string
|
||||
{
|
||||
return __('Tags');
|
||||
}
|
||||
}
|
||||
72
app/Exports/ProfileTransactionsExport.php
Normal file
72
app/Exports/ProfileTransactionsExport.php
Normal file
@@ -0,0 +1,72 @@
|
||||
<?php
|
||||
|
||||
namespace App\Exports;
|
||||
|
||||
use Illuminate\Support\Collection;
|
||||
use Maatwebsite\Excel\Concerns\Exportable;
|
||||
use Maatwebsite\Excel\Concerns\FromCollection;
|
||||
use Maatwebsite\Excel\Concerns\WithHeadings;
|
||||
use Maatwebsite\Excel\Concerns\WithMapping;
|
||||
use Maatwebsite\Excel\Concerns\WithTitle;
|
||||
|
||||
class ProfileTransactionsExport implements FromCollection, WithTitle, WithHeadings, WithMapping
|
||||
{
|
||||
use Exportable;
|
||||
|
||||
protected $data;
|
||||
|
||||
public function __construct(Collection $data)
|
||||
{
|
||||
$this->data = $data;
|
||||
}
|
||||
|
||||
public function collection()
|
||||
{
|
||||
return $this->data;
|
||||
}
|
||||
|
||||
public function headings(): array
|
||||
{
|
||||
return [
|
||||
__('Nr.'),
|
||||
__('Date'),
|
||||
__('Amount'),
|
||||
__('Amount in minutes'),
|
||||
__('Amount in hours'),
|
||||
__('Debit/Credit'),
|
||||
__('Account nr.'),
|
||||
__('Account name'),
|
||||
__('Counter acc. nr.'),
|
||||
__('Counter acc. name'),
|
||||
__('Relation name'),
|
||||
__('Relation full name'),
|
||||
__('Type'),
|
||||
__('Description'),
|
||||
];
|
||||
}
|
||||
|
||||
public function map($transaction): array
|
||||
{
|
||||
return [
|
||||
$transaction['trans_id'],
|
||||
$transaction['datetime'],
|
||||
tbFormat($transaction['amount']),
|
||||
$transaction['amount'],
|
||||
round($transaction['amount'] / 60, 4),
|
||||
__($transaction['c/d']),
|
||||
$transaction['account_id'],
|
||||
__(ucfirst(strtolower($transaction['account_name']))),
|
||||
$transaction['account_counter_id'],
|
||||
__(ucfirst(strtolower($transaction['account_counter_name']))),
|
||||
$transaction['relation'],
|
||||
$transaction['relation_full_name'],
|
||||
__(ucfirst(strtolower($transaction['type']))),
|
||||
$transaction['description'],
|
||||
];
|
||||
}
|
||||
|
||||
public function title(): string
|
||||
{
|
||||
return __('Transactions');
|
||||
}
|
||||
}
|
||||
140
app/Exports/ReportsExport.php
Normal file
140
app/Exports/ReportsExport.php
Normal file
@@ -0,0 +1,140 @@
|
||||
<?php
|
||||
|
||||
namespace App\Exports;
|
||||
|
||||
use Illuminate\Support\Collection;
|
||||
use Maatwebsite\Excel\Concerns\Exportable;
|
||||
use Maatwebsite\Excel\Concerns\FromCollection;
|
||||
use Maatwebsite\Excel\Concerns\WithHeadings;
|
||||
use Maatwebsite\Excel\Concerns\WithMapping;
|
||||
use Maatwebsite\Excel\Concerns\WithTitle;
|
||||
|
||||
class ReportsExport implements FromCollection, WithTitle, WithHeadings, WithMapping
|
||||
{
|
||||
use Exportable;
|
||||
|
||||
protected $data;
|
||||
|
||||
public function __construct(array $data)
|
||||
{
|
||||
$this->data = $data;
|
||||
}
|
||||
|
||||
public function collection()
|
||||
{
|
||||
$exportRows = collect();
|
||||
|
||||
// Add period information header
|
||||
$exportRows->push([
|
||||
'section' => 'PERIOD',
|
||||
'name' => __('Period'),
|
||||
'start_balance' => $this->data['period']['from_date_formatted'] . ' - ' . $this->data['period']['to_date_formatted'],
|
||||
'end_balance' => '',
|
||||
'difference' => '',
|
||||
'type' => 'header'
|
||||
]);
|
||||
|
||||
// Add empty row
|
||||
$exportRows->push([
|
||||
'section' => '',
|
||||
'name' => '',
|
||||
'start_balance' => '',
|
||||
'end_balance' => '',
|
||||
'difference' => '',
|
||||
'type' => 'separator'
|
||||
]);
|
||||
|
||||
// Add account balances section header
|
||||
$exportRows->push([
|
||||
'section' => 'ACCOUNTS',
|
||||
'name' => __('Account Balances'),
|
||||
'start_balance' => '',
|
||||
'end_balance' => '',
|
||||
'difference' => '',
|
||||
'type' => 'header'
|
||||
]);
|
||||
|
||||
// Add individual accounts
|
||||
foreach ($this->data['accounts'] as $account) {
|
||||
$exportRows->push([
|
||||
'section' => 'ACCOUNT',
|
||||
'name' => $account['name'],
|
||||
'start_balance' => $account['start_balance_formatted'],
|
||||
'end_balance' => $account['end_balance_formatted'],
|
||||
'difference' => $account['difference_formatted'],
|
||||
'type' => 'account'
|
||||
]);
|
||||
}
|
||||
|
||||
// Add totals row
|
||||
$exportRows->push([
|
||||
'section' => 'TOTAL',
|
||||
'name' => __('TOTAL'),
|
||||
'start_balance' => $this->data['totals']['start_balance_formatted'],
|
||||
'end_balance' => $this->data['totals']['end_balance_formatted'],
|
||||
'difference' => $this->data['totals']['difference_formatted'],
|
||||
'type' => 'total'
|
||||
]);
|
||||
|
||||
// Add empty row
|
||||
$exportRows->push([
|
||||
'section' => '',
|
||||
'name' => '',
|
||||
'start_balance' => '',
|
||||
'end_balance' => '',
|
||||
'difference' => '',
|
||||
'type' => 'separator'
|
||||
]);
|
||||
|
||||
// Add transaction types section header
|
||||
$exportRows->push([
|
||||
'section' => 'TRANSACTION_TYPES',
|
||||
'name' => __('Transaction Types'),
|
||||
'start_balance' => '',
|
||||
'end_balance' => '',
|
||||
'difference' => '',
|
||||
'type' => 'header'
|
||||
]);
|
||||
|
||||
// Add transaction type breakdown
|
||||
foreach ($this->data['transaction_types'] as $transactionType) {
|
||||
$exportRows->push([
|
||||
'section' => 'TYPE',
|
||||
'name' => $transactionType['type_name'],
|
||||
'start_balance' => $transactionType['incoming_formatted'] . ' (' . __('In') . ')',
|
||||
'end_balance' => $transactionType['outgoing_formatted'] . ' (' . __('Out') . ')',
|
||||
'difference' => $transactionType['net_formatted'] . ' (' . __('Net') . ')',
|
||||
'type' => 'transaction_type'
|
||||
]);
|
||||
}
|
||||
|
||||
return $exportRows;
|
||||
}
|
||||
|
||||
public function headings(): array
|
||||
{
|
||||
return [
|
||||
__('Section'),
|
||||
__('Name'),
|
||||
__('Start Balance / Incoming'),
|
||||
__('End Balance / Outgoing'),
|
||||
__('Difference / Net'),
|
||||
];
|
||||
}
|
||||
|
||||
public function map($row): array
|
||||
{
|
||||
return [
|
||||
$row['section'],
|
||||
$row['name'],
|
||||
$row['start_balance'],
|
||||
$row['end_balance'],
|
||||
$row['difference'],
|
||||
];
|
||||
}
|
||||
|
||||
public function title(): string
|
||||
{
|
||||
return __('Account Report');
|
||||
}
|
||||
}
|
||||
77
app/Exports/TransactionsExport.php
Normal file
77
app/Exports/TransactionsExport.php
Normal file
@@ -0,0 +1,77 @@
|
||||
<?php
|
||||
|
||||
namespace App\Exports;
|
||||
|
||||
use Illuminate\Support\Collection;
|
||||
use Maatwebsite\Excel\Concerns\Exportable;
|
||||
use Maatwebsite\Excel\Concerns\FromCollection;
|
||||
use Maatwebsite\Excel\Concerns\WithHeadings;
|
||||
use Maatwebsite\Excel\Concerns\WithMapping;
|
||||
use Maatwebsite\Excel\Concerns\WithTitle;
|
||||
|
||||
class TransactionsExport implements FromCollection, WithTitle, WithHeadings, WithMapping
|
||||
{
|
||||
use Exportable;
|
||||
|
||||
protected $data;
|
||||
|
||||
public function __construct(Collection $data)
|
||||
{
|
||||
$this->data = $data;
|
||||
}
|
||||
|
||||
public function collection()
|
||||
{
|
||||
return $this->data;
|
||||
}
|
||||
|
||||
|
||||
public function headings(): array
|
||||
{
|
||||
return [
|
||||
__('Nr.'),
|
||||
__('Date'),
|
||||
__('Amount'),
|
||||
__('Amount in minutes'),
|
||||
__('Amount in hours'),
|
||||
__('Debit/Credit'),
|
||||
__('Account nr.'),
|
||||
__('Account name'),
|
||||
__('Acc. holder'),
|
||||
__('Acc. holder full name'),
|
||||
__('Counter acc. nr.'),
|
||||
__('Counter acc. name'),
|
||||
__('Relation name'),
|
||||
__('Relation full name'),
|
||||
__('Type'),
|
||||
__('Description'),
|
||||
];
|
||||
}
|
||||
|
||||
public function map($transaction): array
|
||||
{
|
||||
return [
|
||||
$transaction['trans_id'],
|
||||
$transaction['datetime'],
|
||||
tbFormat($transaction['amount']),
|
||||
$transaction['amount'],
|
||||
round($transaction['amount'] / 60, 4),
|
||||
__($transaction['c/d']),
|
||||
$transaction['account_id'],
|
||||
__(ucfirst(strtolower($transaction['account_name']))),
|
||||
$transaction['account_holder_name'],
|
||||
$transaction['account_holder_full_name'],
|
||||
$transaction['account_counter_id'],
|
||||
__(ucfirst(strtolower($transaction['account_counter_name']))),
|
||||
$transaction['relation'],
|
||||
$transaction['relation_full_name'],
|
||||
__(ucfirst(strtolower($transaction['type']))),
|
||||
$transaction['description'],
|
||||
];
|
||||
}
|
||||
|
||||
public function title(): string
|
||||
{
|
||||
return __('Transactions');
|
||||
}
|
||||
}
|
||||
76
app/Exports/UsersExport.php
Normal file
76
app/Exports/UsersExport.php
Normal file
@@ -0,0 +1,76 @@
|
||||
<?php
|
||||
|
||||
namespace App\Exports;
|
||||
|
||||
use App\Models\User;
|
||||
use Illuminate\Support\Carbon;
|
||||
use Maatwebsite\Excel\Concerns\Exportable;
|
||||
use Maatwebsite\Excel\Concerns\FromQuery;
|
||||
use Maatwebsite\Excel\Concerns\WithColumnFormatting;
|
||||
use Maatwebsite\Excel\Concerns\WithHeadings;
|
||||
use Maatwebsite\Excel\Concerns\WithMapping;
|
||||
use PhpOffice\PhpSpreadsheet\Style\NumberFormat;
|
||||
|
||||
class UsersExport implements FromQuery, WithHeadings, WithMapping, WithColumnFormatting
|
||||
{
|
||||
use Exportable;
|
||||
|
||||
public function __construct(int $year = null)
|
||||
{
|
||||
$this->year = $year;
|
||||
}
|
||||
|
||||
public function headings(): array
|
||||
{
|
||||
return [
|
||||
'Name',
|
||||
'Full name',
|
||||
'Email',
|
||||
'Created At',
|
||||
'Updated At',
|
||||
'Language',
|
||||
];
|
||||
}
|
||||
|
||||
|
||||
public function query()
|
||||
{
|
||||
$query = User::query()
|
||||
->select(
|
||||
'name',
|
||||
'full_name',
|
||||
'email',
|
||||
'created_at',
|
||||
'updated_at',
|
||||
'lang_preference'
|
||||
);
|
||||
|
||||
if ($this->year) {
|
||||
$query->whereYear('created_at', $this->year);
|
||||
}
|
||||
|
||||
return $query;
|
||||
}
|
||||
|
||||
public function map($user): array // Note that $user is created in this line
|
||||
{
|
||||
return [
|
||||
$user->name,
|
||||
$user->full_name,
|
||||
$user->email,
|
||||
Carbon::parse($user->created_at)->translatedFormat('Y-m-d H:i:s'),
|
||||
Carbon::parse($user->updated_at)->translatedFormat('Y-m-d H:i:s'),
|
||||
];
|
||||
}
|
||||
|
||||
|
||||
public function columnFormats(): array
|
||||
{
|
||||
// The columnFormats method sets the format of the date columns to NumberFormat::FORMAT_TEXT
|
||||
// to ensure the dates are treated as text, preserving the locale-specific formatting.
|
||||
return [
|
||||
'D' => NumberFormat::FORMAT_DATE_DATETIME,
|
||||
'E' => NumberFormat::FORMAT_DATE_DATETIME,
|
||||
];
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user