-
Notifications
You must be signed in to change notification settings - Fork 144
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #401 from RezaAb/master
Upgrade ImportExportController
- Loading branch information
Showing
4 changed files
with
69 additions
and
44 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
<?php | ||
|
||
|
||
namespace Serverfireteam\Panel; | ||
|
||
use Maatwebsite\Excel\Concerns\FromArray; | ||
use Serverfireteam\Panel\libs\AppHelper; | ||
|
||
class EntityExport implements FromArray | ||
{ | ||
protected $entity; | ||
|
||
public function __construct($entity) | ||
{ | ||
$this->entity = $entity; | ||
} | ||
|
||
public function array(): array | ||
{ | ||
$appHelper = new libs\AppHelper(); | ||
$className = $appHelper->getModel($this->entity); | ||
$data = $className::all()->ToArray(); | ||
$data= json_decode( json_encode($data), true); | ||
return $data; | ||
} | ||
} |