Skip to content

Commit

Permalink
Merge pull request #20 from jargoud/feat/laravel-11
Browse files Browse the repository at this point in the history
Feat/laravel 11
  • Loading branch information
thomascombe authored Jul 16, 2024
2 parents b48691a + bd7c2ed commit f6f96da
Show file tree
Hide file tree
Showing 10 changed files with 100 additions and 12 deletions.
3 changes: 2 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,9 @@ composer require thomascombe/backpack-async-export
| Version | PHP | Laravel | Backpack |
|---------|------------|---------------------|--------------|
| 1.x | 7.4 - ^8.0 | ^8.0 - ^9.0 - ^10.0 | 4.1.* - ~5.0 |
| 2.x | ^8.1 | ^9.0 - ^10.0 | ~5.5 |
| 2.x | ^8.1 | ^9.0 - ^10.0 | ~5.5 - ~6.0 |
| 3.x | ^8.1 | ^10.0 | ~6.0 |
| 4.x | ^8.2 | ^11.0 | ~6.0 |

You can publish and run the migrations with:

Expand Down
13 changes: 7 additions & 6 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -18,21 +18,22 @@
}
],
"require": {
"php": "^8.1",
"php": "^8.2",
"backpack/crud": "~6.0",
"illuminate/contracts": "^10.0",
"illuminate/contracts": "^11.0",
"maatwebsite/excel": "^3.1",
"spatie/laravel-package-tools": "^1.12"
},
"require-dev": {
"nunomaduro/collision": "^6.1|^7.0",
"laravel/scout": "^10.10",
"nunomaduro/collision": "^8.1",
"nunomaduro/larastan": "^2.0",
"orchestra/testbench": "^7.0|^8.0",
"orchestra/testbench": "^9.0",
"phpstan/phpstan": "^1.10",
"phpunit/phpunit": "^9.5",
"phpunit/phpunit": "^10.1",
"spatie/laravel-ray": "^1.30",
"squizlabs/php_codesniffer": "^3.7",
"vimeo/psalm": "^4.25"
"vimeo/psalm": "^5.0"
},
"autoload": {
"psr-4": {
Expand Down
2 changes: 1 addition & 1 deletion resources/lang/en/export.php
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
],
'notifications' => [
'queued' => 'Export launched! Results will be available when ready on "Export" tab',
'sync' => 'Import launched in sync! Results is available on "Import" tab',
'sync' => 'Export launched in sync! Results available on "Export" tab',
],
'errors' => [
'global-export' => 'Error during export',
Expand Down
13 changes: 13 additions & 0 deletions resources/lang/fr/admin.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
<?php

return [
'column' => [
'file' => 'Fichier',
],
'button' => [
'import' => 'Importer',
],
'operation' => [
'import' => 'Importer',
],
];
27 changes: 27 additions & 0 deletions resources/lang/fr/export.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
<?php

return [
'name' => [
'singular' => 'export',
'plurial' => 'exports',
],
'columns' => [
'user_id' => 'Utilisateur',
'export_type' => 'Type',
'filename' => 'Nom du fichier',
'status' => 'Statut',
'error' => 'Erreur',
'completed_at' => 'Terminé le',
],
'buttons' => [
'exports' => 'Exporter',
'download' => 'Télécharger',
],
'notifications' => [
'queued' => 'Export lancé ! Les résultats seront disponible dans l\'onglet "Export" lorsque ce sera prêt.',
'sync' => 'Export lancé en synchrone ! Les résultats sont disponibles dans l\'onglet "Export".',
],
'errors' => [
'global-export' => 'Error during export',
],
];
26 changes: 26 additions & 0 deletions resources/lang/fr/import.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
<?php

return [
'name' => [
'singular' => 'import',
'plurial' => 'imports',
],
'columns' => [
'user_id' => 'Utilisateur',
'export_type' => 'Type',
'filename' => 'Nom du fichier',
'status' => 'Statut',
'error' => 'Erreur',
'completed_at' => 'Terminé le',
],
'buttons' => [
'import' => 'Importer',
],
'notifications' => [
'queued' => 'Import lancé ! Les résultats seront disponible dans l\'onglet "Import" lorsque ce sera prêt.',
'sync' => 'Import lancé en synchrone ! Les résultats sont disponibles dans l\'onglet "Import".',
],
'errors' => [
'global-import' => 'Erreur pendant l\'import',
],
];
8 changes: 7 additions & 1 deletion resources/views/buttons/export.blade.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,13 @@
@php($url = url($crud->route . '/' . config('backpack-async-import-export.admin_export_route')))
@foreach($exports as $export => $exportsName)
<a href="{{ $url }}?{{ Thomascombe\BackpackAsyncExport\Http\Controllers\Admin\Interfaces\MultiExportableCrud::QUERY_PARAM }}={{ $export }}" class="btn btn-secondary">
<i class="la la-download"></i> @lang('backpack-async-export::export.buttons.exports') @if (!empty($exportsName)) ({{ $exportsName }})@endif
<span>
<i class="la la-download"></i>
@lang('backpack-async-export::export.buttons.exports')
@if(!empty($exportsName))
({{ $exportsName }})
@endif
</span>
</a>
@endforeach
@endif
5 changes: 4 additions & 1 deletion resources/views/buttons/import.blade.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,9 @@
@php($url = url('/' . $route))

<a href="{{ $url }}" class="btn btn-secondary">
<i class="la la-upload"></i> @lang('backpack-async-export::import.buttons.import')
<span>
<i class="la la-upload"></i>
@lang('backpack-async-export::import.buttons.import')
</span>
</a>
@endif
13 changes: 12 additions & 1 deletion resources/views/pages/import.blade.php
Original file line number Diff line number Diff line change
@@ -1,5 +1,16 @@
@extends(backpack_view('blank'))

@php
$defaultBreadcrumbs = [
trans('backpack::crud.admin') => backpack_url('dashboard'),
$crud->entity_name_plural => url($crud->route),
trans('backpack-async-export::admin.operation.import') => false,
];
// if breadcrumbs aren't defined in the CrudController, use the default breadcrumbs
$breadcrumbs = $breadcrumbs ?? $defaultBreadcrumbs;
@endphp

@section('header')
<section class="header-operation container-fluid animated fadeIn d-flex mb-2 align-items-baseline d-print-none" bp-section="page-header">
<h1 class="text-capitalize mb-0" bp-section="page-heading">{!! $crud->getHeading() ?? $crud->entity_name_plural !!}</h1>
Expand Down Expand Up @@ -31,7 +42,7 @@
)

<div class="d-none" id="parentLoadedAssets">{{ json_encode(Basset::loaded()) }}</div>
<div id="saveActions" class="form-group">
<div id="saveActions" class="form-group my-3">
<div class="btn-group" role="group">
<button type="submit" class="btn btn-success">
<span class="la la-save" role="presentation" aria-hidden="true"></span> &nbsp;
Expand Down
2 changes: 1 addition & 1 deletion src/Http/Controllers/Admin/Traits/HasImportButton.php
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,7 @@ private function checkFileMimetype(ImportRequest $request): array
return [true, $validator];
}

return [true];
return [true, null];
}

private function saveUploadFile(ImportRequest $request, ImportExport $exportModel): void
Expand Down

0 comments on commit f6f96da

Please sign in to comment.