Skip to content

Commit 9334ebb

Browse files
committedMar 8, 2025
refactor: remove unused test files and update export methods for better dependency handling
1 parent e4372d9 commit 9334ebb

File tree

10 files changed

+146
-3948
lines changed

10 files changed

+146
-3948
lines changed
 

‎composer.json

+3-9
Original file line numberDiff line numberDiff line change
@@ -28,24 +28,18 @@
2828
"livewire/livewire": "^3.0"
2929
},
3030
"require-dev": {
31-
"laravel/pint": "^1.21",
32-
"orchestra/testbench": "^10.0",
33-
"pestphp/pest": "^3.7"
31+
"laravel/pint": "^1.21"
3432
},
3533
"suggest": {
3634
"maatwebsite/excel": "Allow exporting data to multiple formats",
3735
"carlos-meneses/laravel-mpdf": "Laravel wrapper for mPDF library, used to generate PDFs",
3836
"barryvdh/laravel-dompdf": "A DOMPDF Wrapper for Laravel, used to generate PDFs"
3937
},
4038
"config": {
41-
"sort-packages": true,
42-
"allow-plugins": {
43-
"pestphp/pest-plugin": true
44-
}
39+
"sort-packages": true
4540
},
4641
"scripts": {
47-
"lint": "vendor/bin/pint",
48-
"test": "vendor/bin/pest"
42+
"lint": "vendor/bin/pint"
4943
},
5044
"extra": {
5145
"laravel": {

‎composer.lock

+73-3,862
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

‎lang/ar/datatable.php

+64
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,64 @@
1+
<?php
2+
3+
return [
4+
5+
/*
6+
|--------------------------------------------------------------------------
7+
| Datatable Language Lines
8+
|--------------------------------------------------------------------------
9+
|
10+
| The following language lines are used during datatable rendering.
11+
|
12+
|
13+
*/
14+
15+
'search' => 'بحث...',
16+
17+
'pagination' => [
18+
'next' => 'التالي',
19+
'previous' => 'السابق',
20+
'empty' => 'لم يتم العثور على أي بيانات',
21+
'showing' => 'عرض :first إلى :last من :total نتيجة',
22+
],
23+
24+
'exports' => [
25+
'excel' => 'تصدير Excel',
26+
'csv' => 'تصدير CSV',
27+
'pdf' => 'تصدير PDF',
28+
'json' => 'تصدير JSON',
29+
],
30+
31+
'actions' => [
32+
'view' => 'عرض',
33+
'edit' => 'تعديل',
34+
'delete' => 'حذف',
35+
'export' => 'تصدير',
36+
'confirm' => 'هل أنت متأكد أنك تريد تنفيذ هذا الإجراء؟',
37+
],
38+
39+
'filters' => [
40+
'select' => [
41+
'placeholder' => 'اختر خيارًا',
42+
],
43+
44+
'number' => [
45+
'equals' => 'يساوي',
46+
'not_equals' => 'لا يساوي',
47+
'greater_than' => 'أكبر من',
48+
'greater_than_or_equals' => 'أكبر من أو يساوي',
49+
'less_than' => 'أقل من',
50+
'less_than_or_equals' => 'أقل من أو يساوي',
51+
],
52+
53+
'string' => [
54+
'equals' => 'يساوي',
55+
'not_equals' => 'لا يساوي',
56+
'contains' => 'يحتوي على',
57+
'not_contains' => 'لا يحتوي على',
58+
'starts_with' => 'يبدأ بـ',
59+
'not_starts_with' => 'لا يبدأ بـ',
60+
'ends_with' => 'ينتهي بـ',
61+
'not_ends_with' => 'لا ينتهي بـ',
62+
],
63+
],
64+
];

‎src/Datatable.php

+4-4
Original file line numberDiff line numberDiff line change
@@ -210,14 +210,14 @@ public function paginationSimpleView(): string
210210
*/
211211
public function toXlsx(): \Symfony\Component\HttpFoundation\BinaryFileResponse
212212
{
213-
if (! class_exists(\Maatwebsite\Excel\Excel::class)) {
213+
if (! class_exists('Maatwebsite\Excel\Excel')) {
214214
throw new Exceptions\MissingDependencyException('Please install the "maatwebsite/excel" package to use the toXlsx method.');
215215
}
216216

217217
[$headings, $rows] = $this->getExportData();
218218

219219
$filename = sprintf('export-%s.xlsx', now()->format('Y-m-d_H-i-s'));
220-
$rows->prepend($headings)->storeExcel($filename, null, \Maatwebsite\Excel\Excel::XLSX);
220+
$rows->prepend($headings)->storeExcel($filename, null, 'Xlsx');
221221

222222
return response()->download(storage_path('app/' . $filename))->deleteFileAfterSend(true);
223223
}
@@ -227,14 +227,14 @@ public function toXlsx(): \Symfony\Component\HttpFoundation\BinaryFileResponse
227227
*/
228228
public function toCsv(): \Symfony\Component\HttpFoundation\BinaryFileResponse
229229
{
230-
if (! class_exists(\Maatwebsite\Excel\Excel::class)) {
230+
if (! class_exists('Maatwebsite\Excel\Excel')) {
231231
throw new Exceptions\MissingDependencyException('Please install the "maatwebsite/excel" package to use the toCsv method.');
232232
}
233233

234234
[$headings, $rows] = $this->getExportData();
235235

236236
$filename = sprintf('export-%s.csv', now()->format('Y-m-d_H-i-s'));
237-
$rows->prepend($headings)->storeExcel($filename, null, \Maatwebsite\Excel\Excel::CSV);
237+
$rows->prepend($headings)->storeExcel($filename, null, 'Csv');
238238

239239
return response()->download(storage_path('app/' . $filename))->deleteFileAfterSend(true);
240240
}

‎src/Filters/DateFilter.php

+2-2
Original file line numberDiff line numberDiff line change
@@ -18,9 +18,9 @@ protected function init(): void
1818
$from = $value['from'] ?? null;
1919
$to = $value['to'] ?? null;
2020

21-
if ($from && !$to) {
21+
if ($from && ! $to) {
2222
$query->whereDate($this->column, '>=', $from);
23-
} elseif (!$from && $to) {
23+
} elseif (! $from && $to) {
2424
$query->whereDate($this->column, '<=', $to);
2525
} elseif ($from && $to) {
2626
$query->whereBetween($this->column, [$from, $to]);

‎tests/Feature/.gitkeep

Whitespace-only changes.

‎tests/PackageTestCase.php

-16
This file was deleted.

‎tests/Pest.php

-45
This file was deleted.

‎tests/TestCase.php

-10
This file was deleted.

‎tests/Unit/.gitkeep

Whitespace-only changes.

0 commit comments

Comments
 (0)
Please sign in to comment.