From: Vincent Vanwaelscappel Date: Fri, 22 Sep 2023 06:29:40 +0000 (+0200) Subject: wip #6186 @2.5 X-Git-Url: http://git.cubedesigners.com/?a=commitdiff_plain;h=e9804a287a74d5b7231c259f8e9116c6b4051586;p=fluidbook-toolbox.git wip #6186 @2.5 --- diff --git a/app/Console/Commands/Base/ToolboxCommand.php b/app/Console/Commands/Base/ToolboxCommand.php new file mode 100644 index 000000000..85524cf22 --- /dev/null +++ b/app/Console/Commands/Base/ToolboxCommand.php @@ -0,0 +1,17 @@ +findOrFail($id); + } +} diff --git a/app/Console/Commands/ElearningMediaDownload.php b/app/Console/Commands/ElearningMediaDownload.php new file mode 100644 index 000000000..60289f234 --- /dev/null +++ b/app/Console/Commands/ElearningMediaDownload.php @@ -0,0 +1,19 @@ +find($this->argument('id')); + $scormVersion = $this->option('scormversion') !== 'default' ? $this->option('scormversion') : null; + (new \App\Jobs\ElearningMediaDownload($instance, $this->option('action'), $scormVersion, $this->getUser()))->handle(); + } +} diff --git a/app/Console/Commands/ElearningPackageDownload.php b/app/Console/Commands/ElearningPackageDownload.php new file mode 100644 index 000000000..9f3954e8d --- /dev/null +++ b/app/Console/Commands/ElearningPackageDownload.php @@ -0,0 +1,19 @@ +find($this->argument('id')); + $scormVersion = $this->option('scormversion') !== 'default' ? $this->option('scormversion') : null; + (new \App\Jobs\ElearningPackageDownload($instance, $this->option('action'), $scormVersion, $this->getUser()))->handle(); + } +} diff --git a/app/Console/Commands/FluidbookCollection.php b/app/Console/Commands/FluidbookCollection.php index ce8aa4d0a..46a5e7cfc 100644 --- a/app/Console/Commands/FluidbookCollection.php +++ b/app/Console/Commands/FluidbookCollection.php @@ -2,13 +2,11 @@ namespace App\Console\Commands; +use App\Console\Commands\Base\ToolboxCommand; use App\Jobs\FluidbookCollectionDownload; - -use App\Models\User; -use Cubist\Backpack\Console\Commands\CubistCommand; use Cubist\Util\PHP; -class FluidbookCollection extends CubistCommand +class FluidbookCollection extends ToolboxCommand { protected $signature = 'fluidbook:collection {id} {action}'; protected $description = 'Compile a fluidbook'; @@ -20,7 +18,7 @@ class FluidbookCollection extends CubistCommand { PHP::neverStop(true); $collection = \App\Models\FluidbookCollection::find($this->argument('id')); - $job = new FluidbookCollectionDownload($collection, $this->argument('action'), User::withoutGlobalScope('ownerclause')->findOrFail(5)); + $job = new FluidbookCollectionDownload($collection, $this->argument('action'), $this->getUser()); $job->handle(); } } diff --git a/app/Console/Commands/FluidbookCompile.php b/app/Console/Commands/FluidbookCompile.php index a52dc5b7f..ce2e16e44 100644 --- a/app/Console/Commands/FluidbookCompile.php +++ b/app/Console/Commands/FluidbookCompile.php @@ -2,13 +2,14 @@ namespace App\Console\Commands; +use App\Console\Commands\Base\ToolboxCommand; use App\Fluidbook\Compiler\Compiler; use App\Models\FluidbookPublication; -use Cubist\Backpack\Console\Commands\CubistCommand; use Cubist\Util\PHP; -class FluidbookCompile extends CubistCommand +class FluidbookCompile extends ToolboxCommand { + protected $signature = 'fluidbook:compile {id}'; protected $description = 'Compile a fluidbook'; diff --git a/app/Console/Commands/FluidbookDocumentProcess.php b/app/Console/Commands/FluidbookDocumentProcess.php index 009457e7a..a618e250f 100644 --- a/app/Console/Commands/FluidbookDocumentProcess.php +++ b/app/Console/Commands/FluidbookDocumentProcess.php @@ -2,15 +2,15 @@ namespace App\Console\Commands; +use App\Console\Commands\Base\ToolboxCommand; use App\Jobs\FluidbookDocumentUpload; use App\Models\FluidbookDocument; use App\Models\User; -use Cubist\Backpack\Console\Commands\CubistCommand; use Cubist\Util\PHP; use Cubist\Util\Str; use Illuminate\Support\Facades\Log; -class FluidbookDocumentProcess extends CubistCommand +class FluidbookDocumentProcess extends ToolboxCommand { protected $signature = 'fluidbook:document:process {id}'; protected $description = 'Reprocess a fluidbook document'; diff --git a/app/Console/Commands/FluidbookFarmPing.php b/app/Console/Commands/FluidbookFarmPing.php index d7ef3c62b..95992f9cd 100644 --- a/app/Console/Commands/FluidbookFarmPing.php +++ b/app/Console/Commands/FluidbookFarmPing.php @@ -3,11 +3,11 @@ namespace App\Console\Commands; +use App\Console\Commands\Base\ToolboxCommand; use App\Fluidbook\Farm; -use Cubist\Backpack\Console\Commands\CubistCommand; -class FluidbookFarmPing extends CubistCommand +class FluidbookFarmPing extends ToolboxCommand { protected $signature = 'fluidbook:farm:ping {--force}'; protected $description = 'Manage fluidbook farm'; diff --git a/app/Console/Commands/FluidbookGeneratePreview.php b/app/Console/Commands/FluidbookGeneratePreview.php index 1f9ab63e4..7c13af300 100644 --- a/app/Console/Commands/FluidbookGeneratePreview.php +++ b/app/Console/Commands/FluidbookGeneratePreview.php @@ -2,12 +2,10 @@ namespace App\Console\Commands; -use App\Jobs\GenerateDeliveryThumbnailsPreview; -use Illuminate\Console\Command; +use App\Console\Commands\Base\ToolboxCommand; use App\Models\FluidbookPublication; -use Illuminate\Support\Facades\Bus; -class FluidbookGeneratePreview extends Command +class FluidbookGeneratePreview extends ToolboxCommand { /** * The name and signature of the console command. diff --git a/app/Console/Commands/FluidbookLinksFromPDF.php b/app/Console/Commands/FluidbookLinksFromPDF.php index 61767997a..3f3270a4b 100644 --- a/app/Console/Commands/FluidbookLinksFromPDF.php +++ b/app/Console/Commands/FluidbookLinksFromPDF.php @@ -2,10 +2,10 @@ namespace App\Console\Commands; +use App\Console\Commands\Base\ToolboxCommand; use App\Fluidbook\Link\LinksData; -use Cubist\Backpack\Console\Commands\CubistCommand; -class FluidbookLinksFromPDF extends CubistCommand +class FluidbookLinksFromPDF extends ToolboxCommand { protected $signature = 'fluidbook:links:importfrompdf {id}'; protected $description = 'Import links from PDF'; diff --git a/app/Console/Commands/FluidbookLoadbalancerPing.php b/app/Console/Commands/FluidbookLoadbalancerPing.php index 452b4d2e4..27acb4f17 100644 --- a/app/Console/Commands/FluidbookLoadbalancerPing.php +++ b/app/Console/Commands/FluidbookLoadbalancerPing.php @@ -3,12 +3,11 @@ namespace App\Console\Commands; -use App\Fluidbook\Farm; +use App\Console\Commands\Base\ToolboxCommand; use App\Fluidbook\HostingLoadBalancer; -use Cubist\Backpack\Console\Commands\CubistCommand; -class FluidbookLoadbalancerPing extends CubistCommand +class FluidbookLoadbalancerPing extends ToolboxCommand { protected $signature = 'fluidbook:loadbalancer:ping {--force}'; protected $description = 'Manage fluidbook loadbalancer'; diff --git a/app/Console/Commands/FluidbookPackage.php b/app/Console/Commands/FluidbookPackage.php index b8281c1b5..d1ca4dd8c 100644 --- a/app/Console/Commands/FluidbookPackage.php +++ b/app/Console/Commands/FluidbookPackage.php @@ -2,12 +2,12 @@ namespace App\Console\Commands; +use App\Console\Commands\Base\ToolboxCommand; use App\Fluidbook\Packager\Download; use App\Models\FluidbookPublication; use App\Models\User; -use Cubist\Backpack\Console\Commands\CubistCommand; -class FluidbookPackage extends CubistCommand +class FluidbookPackage extends ToolboxCommand { protected $signature = 'fluidbook:package {id} {type=online} {action=download} {--zip}'; protected $description = 'Compile a fluidbook'; @@ -17,7 +17,7 @@ class FluidbookPackage extends CubistCommand */ public function handle() { - $download = new Download(FluidbookPublication::find($this->argument('id')), $this->argument('type'), $this->argument('action'), User::withoutGlobalScope('ownerclause')->findOrFail(5)); + $download = new Download(FluidbookPublication::find($this->argument('id')), $this->argument('type'), $this->argument('action'), $this->getUser()); $download->handle(); } } diff --git a/app/Console/Commands/FluidbookPreprocessImages.php b/app/Console/Commands/FluidbookPreprocessImages.php index 6edb950da..cd0d48fa8 100644 --- a/app/Console/Commands/FluidbookPreprocessImages.php +++ b/app/Console/Commands/FluidbookPreprocessImages.php @@ -2,11 +2,11 @@ namespace App\Console\Commands; +use App\Console\Commands\Base\ToolboxCommand; use App\Jobs\FluidbookImagesPreprocess; -use Cubist\Backpack\Console\Commands\CubistCommand; use Cubist\Util\PHP; -class FluidbookPreprocessImages extends CubistCommand +class FluidbookPreprocessImages extends ToolboxCommand { protected $signature = 'fluidbook:preprocess {id}'; protected $description = 'Compile a fluidbook'; diff --git a/app/Console/Commands/FluidbookPullSources.php b/app/Console/Commands/FluidbookPullSources.php index 0e0316c12..bb7882219 100644 --- a/app/Console/Commands/FluidbookPullSources.php +++ b/app/Console/Commands/FluidbookPullSources.php @@ -2,11 +2,11 @@ namespace App\Console\Commands; +use App\Console\Commands\Base\ToolboxCommand; use App\Models\Traits\FluidbookPlayerBranches; -use Cubist\Backpack\Console\Commands\CubistCommand; use Cubist\Util\PHP; -class FluidbookPullSources extends CubistCommand +class FluidbookPullSources extends ToolboxCommand { protected $signature = 'fluidbook:player:updatesources'; protected $description = 'Update fluidbook player sources from git repos'; diff --git a/app/Console/Commands/FluidbookQuote.php b/app/Console/Commands/FluidbookQuote.php index d555f8edd..4b91008d7 100644 --- a/app/Console/Commands/FluidbookQuote.php +++ b/app/Console/Commands/FluidbookQuote.php @@ -2,11 +2,11 @@ namespace App\Console\Commands; +use App\Console\Commands\Base\ToolboxCommand; use App\Slack\Slack; -use Cubist\Backpack\Console\Commands\CubistCommand; use Cubist\Backpack\Facades\App; -class FluidbookQuote extends CubistCommand +class FluidbookQuote extends ToolboxCommand { protected $signature = 'fluidbook:quote {--reminder}'; protected $description = 'Fluidbook Quotes'; diff --git a/app/Console/Commands/FluidbookSocialImage.php b/app/Console/Commands/FluidbookSocialImage.php index b6a6a65de..d77e5781a 100644 --- a/app/Console/Commands/FluidbookSocialImage.php +++ b/app/Console/Commands/FluidbookSocialImage.php @@ -2,12 +2,12 @@ namespace App\Console\Commands; +use App\Console\Commands\Base\ToolboxCommand; use App\Models\FluidbookPublication; -use Cubist\Backpack\Console\Commands\CubistCommand; use Cubist\Util\ArrayUtil; use Cubist\Util\PHP; -class FluidbookSocialImage extends CubistCommand +class FluidbookSocialImage extends ToolboxCommand { protected $signature = 'fluidbook:socialimage {id} {--force}'; protected $description = 'Generate image for social networks'; diff --git a/app/Console/Commands/FluidbookThemePreview.php b/app/Console/Commands/FluidbookThemePreview.php index 62a103a51..85e54e487 100644 --- a/app/Console/Commands/FluidbookThemePreview.php +++ b/app/Console/Commands/FluidbookThemePreview.php @@ -2,13 +2,13 @@ namespace App\Console\Commands; +use App\Console\Commands\Base\ToolboxCommand; use App\Jobs\GenerateThemePreview; use App\Models\FluidbookTheme; -use Cubist\Backpack\Console\Commands\CubistCommand; use Cubist\Util\ArrayUtil; use Illuminate\Database\Query\Builder; -class FluidbookThemePreview extends CubistCommand +class FluidbookThemePreview extends ToolboxCommand { protected $signature = 'fluidbook:theme:preview {id?}'; protected $description = 'Generate a theme preview'; diff --git a/app/Console/Commands/QuizDownload.php b/app/Console/Commands/QuizDownload.php new file mode 100644 index 000000000..013c798b1 --- /dev/null +++ b/app/Console/Commands/QuizDownload.php @@ -0,0 +1,19 @@ +find($this->argument('id')); + $scormVersion = $this->option('scormversion') !== 'default' ? $this->option('scormversion') : null; + (new \App\Jobs\QuizDownload($instance, $this->option('action'), $scormVersion, $this->getUser()))->handle(); + } +} diff --git a/app/Console/Commands/QuizLogReplay.php b/app/Console/Commands/QuizLogReplay.php deleted file mode 100644 index 95f8c5548..000000000 --- a/app/Console/Commands/QuizLogReplay.php +++ /dev/null @@ -1,53 +0,0 @@ -files('quizlogs', true); - $this->_parseFile('quizlogs/toolbox-audit.log'); -// foreach ($files as $file) { -// $this->_parseFile($file); -// } - } - - public function _parseFile($file) - { - $log = new Document(storage_path($file), Parser::class); - foreach ($log->getParsers() as $parser) { - - if ($parser->getMethod() !== 'POST') { - continue; - } - if (!preg_match('/^\/quiz\/([0-9]+)\/log$/', $parser->getPath(), $matches)) { - continue; - } - $data = $parser->getPostData(); - $log = new QuizAttempt(); - $log->quiz = $matches[1]; - $log->score = $data['score']; - $log->passed = $data['passed'] !== 'false' ? '1' : '0'; - $log->answers = json_encode($data['questions']); - $log->created_at=$parser->getDate()->toDateTimeString(); - $log->updated_at=$parser->getDate()->toDateTimeString(); - dd($log); - //$log->save(); - } - - } -} diff --git a/app/Console/Commands/QuizPullSources.php b/app/Console/Commands/QuizPullSources.php index 0cd7d8df9..e9546ddb2 100644 --- a/app/Console/Commands/QuizPullSources.php +++ b/app/Console/Commands/QuizPullSources.php @@ -2,11 +2,11 @@ namespace App\Console\Commands; +use App\Console\Commands\Base\ToolboxCommand; use App\Models\Traits\QuizBranches; -use Cubist\Backpack\Console\Commands\CubistCommand; use Cubist\Util\PHP; -class QuizPullSources extends CubistCommand +class QuizPullSources extends ToolboxCommand { protected $signature = 'quiz:player:updatesources'; protected $description = 'Update quiz player sources from git repos'; diff --git a/app/Console/Commands/ToolboxPrecache.php b/app/Console/Commands/ToolboxPrecache.php index 2d8d663d6..4805375af 100644 --- a/app/Console/Commands/ToolboxPrecache.php +++ b/app/Console/Commands/ToolboxPrecache.php @@ -2,13 +2,12 @@ namespace App\Console\Commands; +use App\Console\Commands\Base\ToolboxCommand; use App\Fields\FluidbookTTSVoice; -use App\Fluidbook\Farm; use App\Models\FluidbookTranslate; use Cubedesigners\UserDatabase\Permissions; -use Cubist\Backpack\Console\Commands\CubistCommand; -class ToolboxPrecache extends CubistCommand +class ToolboxPrecache extends ToolboxCommand { protected $signature = 'toolbox:precache'; protected $description = 'Precache Toolbox'; diff --git a/app/Console/Commands/ToolboxToWorkshop.php b/app/Console/Commands/ToolboxToWorkshop.php index 7c72de9d1..7fde1dade 100644 --- a/app/Console/Commands/ToolboxToWorkshop.php +++ b/app/Console/Commands/ToolboxToWorkshop.php @@ -2,11 +2,11 @@ namespace App\Console\Commands; +use App\Console\Commands\Base\ToolboxCommand; use App\Models\FluidbookPublication; -use Cubist\Backpack\Console\Commands\CubistCommand; use Illuminate\Support\Facades\DB; -class ToolboxToWorkshop extends CubistCommand +class ToolboxToWorkshop extends ToolboxCommand { protected $signature = 'toolboxtows {id} {targetid=new}'; protected $description = 'Migrate a fluidbook made on the toolbox back to the workshop'; @@ -43,7 +43,5 @@ class ToolboxToWorkshop extends CubistCommand } else { DB::table(self::$_wstable)->where('book_id', $targetid)->update($data); } - - //DB::table(self::$_wstable)->in } } diff --git a/app/Console/Commands/ToolboxTranslations.php b/app/Console/Commands/ToolboxTranslations.php deleted file mode 100644 index 00dba7771..000000000 --- a/app/Console/Commands/ToolboxTranslations.php +++ /dev/null @@ -1,39 +0,0 @@ -setExtensions(['js']); - foreach ($paths as $path) { - $t->addPath(base_path() . '/' . $path); - } - $t->parseFiles(); - dd($t->getStringToTranslate()); - } -} diff --git a/app/Console/Commands/UpdateNWJS.php b/app/Console/Commands/UpdateNWJS.php index d193e0357..ad8ced8f3 100644 --- a/app/Console/Commands/UpdateNWJS.php +++ b/app/Console/Commands/UpdateNWJS.php @@ -2,11 +2,11 @@ namespace App\Console\Commands; -use Cubist\Backpack\Console\Commands\CubistCommand; +use App\Console\Commands\Base\ToolboxCommand; use Cubist\Util\Files\Files; use Cubist\Util\Zip; -class UpdateNWJS extends CubistCommand +class UpdateNWJS extends ToolboxCommand { /** @see https://nwjs.io/ */ diff --git a/app/Console/Commands/UpdatePDFJSLibrary.php b/app/Console/Commands/UpdatePDFJSLibrary.php index 3d0d43cfc..7a9ae3468 100644 --- a/app/Console/Commands/UpdatePDFJSLibrary.php +++ b/app/Console/Commands/UpdatePDFJSLibrary.php @@ -2,11 +2,11 @@ namespace App\Console\Commands; -use Cubist\Backpack\Console\Commands\CubistCommand; +use App\Console\Commands\Base\ToolboxCommand; use Cubist\Util\Files\Files; use Cubist\Util\Zip; -class UpdatePDFJSLibrary extends CubistCommand +class UpdatePDFJSLibrary extends ToolboxCommand { /** @see https://mozilla.github.io/pdf.js/getting_started/#download */ diff --git a/app/Console/Commands/WorkshopMigration.php b/app/Console/Commands/WorkshopMigration.php index c5e037c5f..4cfa1f60a 100644 --- a/app/Console/Commands/WorkshopMigration.php +++ b/app/Console/Commands/WorkshopMigration.php @@ -3,6 +3,7 @@ namespace App\Console\Commands; +use App\Console\Commands\Base\ToolboxCommand; use App\Models\FluidbookDocument; use App\Models\FluidbookPublication; use App\Models\FluidbookTheme; @@ -14,20 +15,18 @@ use Cubist\Util\ArrayUtil; use Cubist\Util\Json; use Cubist\Util\ObjectUtil; use Cubist\Util\PHP; -use Cubist\Util\Text; use Illuminate\Contracts\Cache\Lock; use Illuminate\Support\Facades\Artisan; use Illuminate\Support\Facades\Cache; use Illuminate\Support\Facades\DB; -class WorkshopMigration extends CubistCommand +class WorkshopMigration extends ToolboxCommand { protected $signature = 'ws:migrate {--publications=v2} {--documents=missing} {--quick} {--force}'; protected $description = 'Migrate data from Workshop V2'; protected $_wsRanks = []; const OLD_DB = 'extranet_clean'; protected $_oldRoot = '/home/extranet/www/fluidbook/'; - protected static $_admin = 5; /** @var Lock */ protected Lock $_lock; diff --git a/app/Elearning/QuizCompiler.php b/app/Elearning/QuizCompiler.php index 65e5134d9..3038adc9e 100644 --- a/app/Elearning/QuizCompiler.php +++ b/app/Elearning/QuizCompiler.php @@ -54,11 +54,16 @@ class QuizCompiler extends Base { $this->quiz = $quiz instanceof Quiz ? $quiz : Quiz::withoutGlobalScopes()->find($quiz); $this->theme = $this->quiz->getTheme(); - $this->compilePath = protected_path('quiz/compile/' . $this->quiz->id); + $this->compilePath = protected_path($this->getBaseURL() . '/compile/' . $this->quiz->id); $this->dest = $dest; $this->forceScorm = $forceScorm; } + protected function getBaseURL() + { + return $this->quiz->getOption('name'); + } + public function handle() { $compileVdir = new VirtualDirectory($this->compilePath); diff --git a/app/Http/Controllers/Admin/Operations/Base/BaseDownloadOperation.php b/app/Http/Controllers/Admin/Operations/Base/BaseDownloadOperation.php new file mode 100644 index 000000000..9c4d816a8 --- /dev/null +++ b/app/Http/Controllers/Admin/Operations/Base/BaseDownloadOperation.php @@ -0,0 +1,56 @@ +withoutMiddleware([CheckIfAdmin::class]);; + } + + protected function setupDownloadDefaults() + { + $this->crud->addButtonFromView('line', 'download', $this->button . '.download', 'end'); + } + + protected function package($id, $action, $version = null) + { + $entry = $this->getModelInstance(); + $model = get_class($entry); + $job = $this->downloadJob; + + if (!$model::hasPermission($id, 'read')) { + abort(401); + } + $instance = $model::withoutGlobalScopes()->find($id); + $version = $version ?? $instance->scorm_version; + $job::dispatch($instance, $action, $version, backpack_user())->onQueue('download');; + Alert::add('success', __('La compilation a été placée en file d\'attente. Vous recevrez un email lorsqu\'elle sera terminée.'))->flash(); + return redirect(backpack_url($entry->getOption('name'))); + } + + protected function download($id, $hash, $file) + { + $entry = $this->getModelInstance(); + $model = get_class($entry); + + $instance = $model::withoutGlobalScopes()->where('id', $id)->where('hash', $hash)->first(); + if (null === $instance) { + abort(404, __('Ce fichier est indisponible')); + } + $path = protected_path($entry->getOption('name') . '/download/' . $id . '/' . $file); + if (!file_exists($path)) { + abort(404, __('Le fichier n\'existe pas')); + } + return XSendFileController::sendfile($path); + } +} diff --git a/app/Http/Controllers/Admin/Operations/ELearningMedia/DownloadOperation.php b/app/Http/Controllers/Admin/Operations/ELearningMedia/DownloadOperation.php index 296d2f425..63c76d6a7 100644 --- a/app/Http/Controllers/Admin/Operations/ELearningMedia/DownloadOperation.php +++ b/app/Http/Controllers/Admin/Operations/ELearningMedia/DownloadOperation.php @@ -4,58 +4,14 @@ namespace App\Http\Controllers\Admin\Operations\ELearningMedia; // __('!! e-Learning') -use App\Http\Middleware\CheckIfAdmin; +use App\Http\Controllers\Admin\Operations\Base\BaseDownloadOperation; use App\Jobs\ElearningMediaDownload; -use App\Jobs\QuizDownload; -use App\Models\ELearningMedia; -use App\Models\Quiz; -use Cubist\Backpack\Http\Controllers\Base\XSendFileController; -use Illuminate\Support\Facades\Route; -use Prologue\Alerts\Facades\Alert; trait DownloadOperation { - protected function setupDownloadRoutes($segment, $routeName, $controller) - { - Route::match(['get'], $segment . '/{id}/package/{action}/{version?}', $controller . '@package'); - Route::match(['get'], $segment . '/{id}_{hash}/download/{file}', $controller . '@download')->withoutMiddleware([CheckIfAdmin::class]);; - } - protected function setupDownloadDefaults() - { + use BaseDownloadOperation; - $this->crud->addButtonFromView('line', 'download', 'elearningmedia.download', 'end'); - } - - protected function package($id, $action, $version = null) - { - if (!ElearningMedia::hasPermission($id, 'read')) { - abort(401); - } - $media = ElearningMedia::withoutGlobalScopes()->find($id); - $version = $version ?? $media->scorm_version; - ElearningMediaDownload::dispatch($media, $action, $version, backpack_user())->onQueue('download');; - Alert::add('success', __('La compilation a été placée en file d\'attente. Vous recevrez un email lorsqu\'elle sera terminée.'))->flash(); - return redirect(backpack_url('elearning-media')); - } - - protected function download($id, $hash, $file) - { - $media = ElearningMedia::withoutGlobalScopes()->where('id', $id)->where('hash', $hash)->first(); - if (null === $media) { - abort(404, __('Ce fichier est indisponible')); - } - $path = protected_path('elearning-media/download/' . $id . '/' . $file); - if (!file_exists($path)) { - abort(404, __('Le fichier n\'existe pas')); - } - return XSendFileController::sendfile($path); - } - -// protected function download($id, $action) -// { -// ElearningMediaDownload::dispatch(ELearningMedia::find($id), $action, backpack_user())->onQueue('download');; -// Alert::add('success', __('La compilation a été placée en file d\'attente. Vous recevrez un email lorsqu\'elle sera terminée.'))->flash(); -// return redirect(backpack_url('elearning-media')); -// } + protected $button = 'elearningmedia'; + protected $downloadJob = ElearningMediaDownload::class; } diff --git a/app/Http/Controllers/Admin/Operations/ELearningPackage/DownloadOperation.php b/app/Http/Controllers/Admin/Operations/ELearningPackage/DownloadOperation.php index ab4dca292..edbe68a39 100644 --- a/app/Http/Controllers/Admin/Operations/ELearningPackage/DownloadOperation.php +++ b/app/Http/Controllers/Admin/Operations/ELearningPackage/DownloadOperation.php @@ -2,57 +2,15 @@ namespace App\Http\Controllers\Admin\Operations\ELearningPackage; -use App\Http\Middleware\CheckIfAdmin; +use App\Http\Controllers\Admin\Operations\Base\BaseDownloadOperation; use App\Jobs\ElearningPackageDownload; -use App\Models\ELearningPackage; -use Cubist\Backpack\Http\Controllers\Base\XSendFileController; -use Illuminate\Support\Facades\Route; -use Prologue\Alerts\Facades\Alert; // __('!! e-Learning') trait DownloadOperation { - protected function setupDownloadRoutes($segment, $routeName, $controller) - { - Route::match(['get'], $segment . '/{id}/package/{action}/{version?}', $controller . '@package'); - Route::match(['get'], $segment . '/{id}_{hash}/download/{file}', $controller . '@download')->withoutMiddleware([CheckIfAdmin::class]);; - } + use BaseDownloadOperation; - protected function setupDownloadDefaults() - { - $this->crud->addButtonFromView('line', 'download', 'elearningpackage.download', 'end'); - } - - protected function package($id, $action, $version = null) - { - if (!ElearningPackage::hasPermission($id, 'read')) { - abort(401); - } - $media = ElearningPackage::withoutGlobalScopes()->find($id); - $version = $version ?? $media->scorm_version; - ElearningPackageDownload::dispatch($media, $action, $version, backpack_user())->onQueue('download');; - Alert::add('success', __('La compilation a été placée en file d\'attente. Vous recevrez un email lorsqu\'elle sera terminée.'))->flash(); - return redirect(backpack_url('elearning-package')); - } - - protected function download($id, $hash, $file) - { - $media = ElearningPackage::withoutGlobalScopes()->where('id', $id)->where('hash', $hash)->first(); - if (null === $media) { - abort(404, __('Ce fichier est indisponible')); - } - $path = protected_path('elearningmedia/download/' . $id . '/' . $file); - if (!file_exists($path)) { - abort(404, __('Le fichier n\'existe pas')); - } - return XSendFileController::sendfile($path); - } - -// protected function download($id, $action) -// { -// ElearningPackageDownload::dispatch(ELearningPackage::find($id), $action, backpack_user())->onQueue('download'); -// Alert::add('success', __('La compilation a été placée en file d\'attente. Vous recevrez un email lorsqu\'elle sera terminée.'))->flash(); -// return redirect(backpack_url('elearning-package')); -// } + protected $button = 'elearningpackage'; + protected $downloadJob = ELearningPackageDownload::class; } diff --git a/app/Http/Controllers/Admin/Operations/Quiz/DownloadOperation.php b/app/Http/Controllers/Admin/Operations/Quiz/DownloadOperation.php index f37448398..5f5b3e0e8 100644 --- a/app/Http/Controllers/Admin/Operations/Quiz/DownloadOperation.php +++ b/app/Http/Controllers/Admin/Operations/Quiz/DownloadOperation.php @@ -2,54 +2,15 @@ namespace App\Http\Controllers\Admin\Operations\Quiz; -use App\Fields\SCORMVersion; -use App\Http\Middleware\CheckIfAdmin; +use App\Http\Controllers\Admin\Operations\Base\BaseDownloadOperation; use App\Jobs\QuizDownload; -use App\Models\FluidbookPublication; -use App\Models\Quiz; -use Cubist\Backpack\Http\Controllers\Base\XSendFileController; -use Cubist\Scorm\Version; -use Illuminate\Support\Facades\Route; -use Prologue\Alerts\Facades\Alert; // __('!! e-Learning') trait DownloadOperation { - protected function setupDownloadRoutes($segment, $routeName, $controller) - { - Route::match(['get'], $segment . '/{id}/package/{action}/{version?}', $controller . '@package'); - Route::match(['get'], $segment . '/{id}_{hash}/download/{file}', $controller . '@download')->withoutMiddleware([CheckIfAdmin::class]);; - } + use BaseDownloadOperation; - protected function setupDownloadDefaults() - { - - $this->crud->addButtonFromView('line', 'download', 'quiz.download', 'end'); - } - - protected function package($id, $action, $version = null) - { - if (!Quiz::hasPermission($id, 'read')) { - abort(401); - } - $quiz = Quiz::withoutGlobalScopes()->find($id); - $version = $version ?? $quiz->scorm_version; - QuizDownload::dispatch($quiz, $action, $version, backpack_user())->onQueue('download');; - Alert::add('success', __('La compilation a été placée en file d\'attente. Vous recevrez un email lorsqu\'elle sera terminée.'))->flash(); - return redirect(backpack_url('quiz')); - } - - protected function download($id, $hash, $file) - { - $quiz = Quiz::withoutGlobalScopes()->where('id', $id)->where('hash', $hash)->first(); - if (null === $quiz) { - abort(404, __('Ce fichier est indisponible')); - } - $path = protected_path('quiz/download/' . $id . '/' . $file); - if (!file_exists($path)) { - abort(404, __('Le fichier n\'existe pas')); - } - return XSendFileController::sendfile($path); - } + protected $button = 'quiz'; + protected $downloadJob = QuizDownload::class; } diff --git a/app/Jobs/Base.php b/app/Jobs/Base.php index 8000a9970..2a340e5b0 100644 --- a/app/Jobs/Base.php +++ b/app/Jobs/Base.php @@ -9,6 +9,8 @@ use Illuminate\Support\Facades\Cache; class Base extends \Cubist\Backpack\Jobs\Base { + protected $tries = 1; + /** * @var User|null */ diff --git a/app/Jobs/DownloadBase.php b/app/Jobs/DownloadBase.php index bdf206760..da61686fa 100644 --- a/app/Jobs/DownloadBase.php +++ b/app/Jobs/DownloadBase.php @@ -6,27 +6,18 @@ use App\Mail\DeferredDownload; use App\Models\User; use App\Notifications\DownloadReady; use App\Services\ScormCloud; -use App\Slack\Message; use App\Slack\Slack; use Cubist\Backpack\Facades\App; use Cubist\Backpack\Magic\Models\CubistMagicAbstractModel; use Cubist\Util\Files\Files; use Cubist\Util\Str; use Cubist\Util\Zip; -use GrahamCampbell\Markdown\Facades\Markdown; -use Illuminate\Support\Facades\Log; use Illuminate\Support\Facades\Mail; -use JoliCode\Slack\ClientFactory; use League\CommonMark\CommonMarkConverter; use League\CommonMark\Exception\CommonMarkException; class DownloadBase extends Base { - /** - * @var string - */ - protected $type = 'base'; - /** * @var CubistMagicAbstractModel */ @@ -85,23 +76,33 @@ class DownloadBase extends Base Mail::send($mail); } + protected function getBaseURL() + { + return $this->entry->getOption('name'); + } + + protected function getType() + { + return str_replace('-', '', $this->getBaseURL()); + } + protected function _fname($title = null, $extension = 'zip') { if (null === $title) { $title = $this->_title(); } - return Str::slugCase($this->type . '-' . date('Ymdhis') . '-' . md5(rand(10000, 100000000)) . '-' . Str::slug($title)) . '.' . $extension; + return Str::slugCase($this->getType() . '-' . date('Ymdhis') . '-' . md5(rand(10000, 100000000)) . '-' . Str::slug($title)) . '.' . $extension; } protected function _dest($fname) { - return Files::mkdir(protected_path($this->type . '/download/' . $this->entry->id . '/')) . $fname; + return Files::mkdir(protected_path($this->getBaseURL() . '/download/' . $this->entry->id . '/')) . $fname; } protected function _url($fname) { - return url('/' . $this->type . '/' . $this->entry->id . '_' . $this->entry->hash . '/download/' . $fname); + return url('/' . $this->getBaseURL() . '/' . $this->entry->id . '_' . $this->entry->hash . '/download/' . $fname); } protected function _title() @@ -126,7 +127,7 @@ class DownloadBase extends Base $showTextIfNotEmail = false; if ($this->action === 'scormcloud') { try { - $scormURL = ScormCloud::send($url, env('SCORM_CLOUD_PREFIX', 'toolbox_') . $this->type . '_' . $this->_id()); + $scormURL = ScormCloud::send($url, env('SCORM_CLOUD_PREFIX', 'toolbox_') . $this->getType() . '_' . $this->_id()); $actions[__('Tester sur SCORM Cloud')] = $scormURL; } catch (\Exception $e) { $text .= "\n\n" . __('Une erreur s\'est produite lors de l\'envoi sur SCORM Cloud (App ID :appid) : :error (:url)', ['error' => $e->getMessage(), 'appid' => env('SCORM_CLOUD_APP_ID'), 'url' => $url]); @@ -134,7 +135,7 @@ class DownloadBase extends Base } } } catch (\Exception $e) { - $subject = __('Erreur lors de la compilation du :type :nb', ['nb' => $this->_id(), 'type' => $this->type]); + $subject = __('Erreur lors de la compilation du :type :nb', ['nb' => $this->_id(), 'type' => $this->getType()]); $text = __('Détails de l\'erreur :message', ['message' => $e->getMessage() . ' at line ' . $e->getLine() . ' of ' . $e->getFile()]); $showTextIfNotEmail = true; $actions = []; @@ -151,10 +152,12 @@ class DownloadBase extends Base protected function _compileandpackage() { + echo 'Compile' . "\n"; $compilepath = $this->_compile(); + echo 'Compiled : ' . $compilepath . "\n"; $fname = $this->_fname(); - $dest = Files::mkdir(protected_path($this->type . '/download/' . $this->entry->id . '/')) . $fname; - + $dest = Files::mkdir(protected_path($this->getBaseURL() . '/download/' . $this->entry->id . '/')) . $fname; + echo 'Zip to ' . $dest . "\n"; Zip::archive($compilepath, $dest); if (!file_exists($dest)) { throw new \Exception('An error occured while compiling the collection'); @@ -166,6 +169,7 @@ class DownloadBase extends Base protected function _compile() { $compilepath = $this->entry->getFinalPath(); + echo 'Compile to '.$compilepath."\n"; $this->entry->compile($compilepath); return $compilepath; } diff --git a/app/Jobs/ElearningMediaDownload.php b/app/Jobs/ElearningMediaDownload.php index 8d350e1ae..694cce547 100644 --- a/app/Jobs/ElearningMediaDownload.php +++ b/app/Jobs/ElearningMediaDownload.php @@ -2,13 +2,8 @@ namespace App\Jobs; -use App\Services\ScormCloud; -use Cubist\Util\Files\Files; -use Cubist\Util\Zip; - -class ElearningMediaDownload extends DownloadBase +class ElearningMediaDownload extends ScormDownloadBase { - protected $type = 'elearningmedia'; // __('Media ":title" (#:nb) prêt au téléchargement') protected $_subject = 'Media ":title" (#:nb) prêt au téléchargement'; // __('Le media ":title" est prêt au téléchargement'); diff --git a/app/Jobs/ElearningPackageDownload.php b/app/Jobs/ElearningPackageDownload.php index 53a73876c..12bb2f006 100644 --- a/app/Jobs/ElearningPackageDownload.php +++ b/app/Jobs/ElearningPackageDownload.php @@ -2,13 +2,8 @@ namespace App\Jobs; -use App\Services\ScormCloud; -use Cubist\Util\Files\Files; -use Cubist\Util\Zip; - -class ElearningPackageDownload extends DownloadBase +class ElearningPackageDownload extends ScormDownloadBase { - protected $type = 'elearningpackage'; // __('Package ":title" (#:nb) prêt au téléchargement') protected $_subject = 'Package ":title" (#:nb) prêt au téléchargement'; // __('Le package ":title" est prêt au téléchargement'); diff --git a/app/Jobs/FluidbookDocumentUpload.php b/app/Jobs/FluidbookDocumentUpload.php index 91a64c42f..ba68b9ae5 100644 --- a/app/Jobs/FluidbookDocumentUpload.php +++ b/app/Jobs/FluidbookDocumentUpload.php @@ -21,11 +21,6 @@ class FluidbookDocumentUpload extends Base */ protected $fluidbook_id; - /** - * @var int - */ - public $tries = 1; - public $queue = 'fluidbookprocess'; /** diff --git a/app/Jobs/QuizDownload.php b/app/Jobs/QuizDownload.php index a67a0ed2c..d4b560e56 100644 --- a/app/Jobs/QuizDownload.php +++ b/app/Jobs/QuizDownload.php @@ -2,33 +2,10 @@ namespace App\Jobs; -use App\Services\ScormCloud; -use Cubist\Util\Files\Files; -use Cubist\Util\Zip; - -class QuizDownload extends DownloadBase +class QuizDownload extends ScormDownloadBase { - - protected $type = 'quiz'; // __('Quiz ":title" (#:nb) prêt au téléchargement') protected $_subject = 'Quiz ":title" (#:nb) prêt au téléchargement'; // __('Le quiz ":title" est prêt au téléchargement') protected $_text = 'Le quiz ":title" est prêt au téléchargement'; - - protected $_scormVersion = null; - - public function __construct($entry, $action, $scormVersion = null, $user = null) - { - $this->_scormVersion = $scormVersion; - parent::__construct($entry, $action, $user); - } - - protected function _compile() - { - if (null !== $this->_scormVersion) { - $this->entry->scorm_version = $this->_scormVersion; - } - return parent::_compile(); - } - } diff --git a/app/Jobs/ScormDownloadBase.php b/app/Jobs/ScormDownloadBase.php new file mode 100644 index 000000000..6479b6a46 --- /dev/null +++ b/app/Jobs/ScormDownloadBase.php @@ -0,0 +1,24 @@ +_scormVersion = $scormVersion; + parent::__construct($entry, $action, $user); + } + + protected function _compile() + { + if (null !== $this->_scormVersion) { + $this->entry->scorm_version = $this->_scormVersion; + } + return parent::_compile(); + } +} diff --git a/app/Models/Base/ToolboxDownloadable.php b/app/Models/Base/ToolboxDownloadable.php new file mode 100644 index 000000000..050d6e243 --- /dev/null +++ b/app/Models/Base/ToolboxDownloadable.php @@ -0,0 +1,22 @@ +checkHash(); + return parent::onSaving(); + } + + public function getFinalPath() + { + return Files::mkdir(protected_path($this->getOption('name') . '/final/' . $this->id)); + } +} diff --git a/app/Models/ELearningMedia.php b/app/Models/ELearningMedia.php index 9b7815593..dd0630fe4 100644 --- a/app/Models/ELearningMedia.php +++ b/app/Models/ELearningMedia.php @@ -7,6 +7,7 @@ use App\Http\Controllers\Admin\Operations\ChangeownerOperation; use App\Http\Controllers\Admin\Operations\ELearningMedia\ImportOperation; use App\Http\Controllers\Admin\Operations\ELearningMedia\PreviewOperation; use App\Http\Controllers\Admin\Operations\ELearningMedia\DownloadOperation; +use App\Models\Base\ToolboxDownloadable; use App\Models\Base\ToolboxModel; use App\Models\Traits\CheckHash; use App\Models\Traits\SCORMVersionTrait; @@ -23,7 +24,7 @@ use Spatie\MediaLibrary\MediaCollections\Models\Media; class ELearningMedia extends ToolboxModel { use SCORMVersionTrait; - use CheckHash; + use ToolboxDownloadable; protected $table = 'elearning_media'; @@ -94,11 +95,6 @@ class ELearningMedia extends ToolboxModel } } - public function getFinalPath() - { - return protected_path('elearningmedia/final/' . $this->id); - } - public function compile($dest) { $owner = User::withoutGlobalScopes()->findOrFail($this->owner); @@ -154,12 +150,6 @@ class ELearningMedia extends ToolboxModel return $title; } - public function onSaving(): bool - { - $this->checkHash(); - return parent::onSaving(); - } - public function getIdTitleAttribute() { return $this->id . ' - ' . $this->title; diff --git a/app/Models/ELearningPackage.php b/app/Models/ELearningPackage.php index b5d2ae68e..de03b0b6a 100644 --- a/app/Models/ELearningPackage.php +++ b/app/Models/ELearningPackage.php @@ -7,6 +7,7 @@ use App\Http\Controllers\Admin\Operations\ChangeownerOperation; use App\Http\Controllers\Admin\Operations\ELearningPackage\ImportOperation; use App\Http\Controllers\Admin\Operations\ELearningPackage\PreviewOperation; use App\Http\Controllers\Admin\Operations\ELearningPackage\DownloadOperation; +use App\Models\Base\ToolboxDownloadable; use App\Models\Base\ToolboxModel; use App\Models\Traits\CheckHash; use App\Models\Traits\SCORMVersionTrait; @@ -26,7 +27,7 @@ use DirectoryIterator; class ELearningPackage extends ToolboxModel { use SCORMVersionTrait; - use CheckHash; + use ToolboxDownloadable; protected $table = 'elearning_package'; @@ -75,10 +76,6 @@ class ELearningPackage extends ToolboxModel $this->addField('contents', BunchOfFieldsMultiple::class, __('Contenus'), ['bunch' => ElearningPackageContent::class, 'edit_label' => __('Editer « :label »', ['label' => '%content_type'])]); } - public function getFinalPath() - { - return protected_path('elearningpackage/final/' . $this->id); - } public function compile($dest, $user = null) { @@ -163,12 +160,6 @@ class ELearningPackage extends ToolboxModel return $res; } - public function onSaving(): bool - { - $this->checkHash(); - return parent::onSaving(); - } - /** * @param $id int * @param $vdir VirtualDirectory diff --git a/app/Models/FluidbookCollection.php b/app/Models/FluidbookCollection.php index ce9d86d1a..6d32f4c3d 100644 --- a/app/Models/FluidbookCollection.php +++ b/app/Models/FluidbookCollection.php @@ -6,6 +6,7 @@ use App\Fields\FluidbookExportVersion; use App\Http\Controllers\Admin\Operations\ChangeownerOperation; use App\Http\Controllers\Admin\Operations\FluidbookCollection\DownloadOperation; use App\Http\Controllers\Admin\Operations\FluidbookCollection\PreviewOperation; +use App\Models\Base\ToolboxDownloadable; use App\Models\Base\ToolboxModel; use App\Models\Traits\CheckHash; use App\Slack\Slack; @@ -22,7 +23,7 @@ use Cubist\Util\Files\Files; // __('!! Collections de fluidbooks') class FluidbookCollection extends ToolboxModel { - use CheckHash; + use ToolboxDownloadable; protected $table = 'fluidbook_collection'; protected $_options = ['name' => 'fluidbook-collection', @@ -41,7 +42,7 @@ class FluidbookCollection extends ToolboxModel $this->addOwnerField(); - $this->addField('hash', Hidden::class); + $this->addHashField(); $this->addField('type', SelectFromArray::class, __('Type'), ['can' => 'fluidbook-collection:write', 'column' => true, 'options' => ['export' => __('Export'), 'export_multilang' => __('Export multilingue'), 'scorm_multilang' => __('SCORM multilingue')]]); $this->addField('locale_switch', Checkbox::class, __('Permettre le changement de langue'), ['when' => ['type' => ['scorm_multilang', 'export_multilang']], 'default' => true]); $this->addField('redirection_algorithm', SelectFromArray::class, __('Algorithme de choix de la version'), @@ -63,11 +64,6 @@ class FluidbookCollection extends ToolboxModel return Files::mkdir(protected_path('fluidbookcollection/final/' . $this->id)); } - public function onSaving(): bool - { - $this->checkHash(); - return parent::onSaving(); - } public function allowsPreview() diff --git a/app/Models/FluidbookPublication.php b/app/Models/FluidbookPublication.php index f251e3924..e9d3f7a9d 100644 --- a/app/Models/FluidbookPublication.php +++ b/app/Models/FluidbookPublication.php @@ -31,6 +31,7 @@ use App\Http\Controllers\Admin\Operations\FluidbookPublication\YSLOperation; use App\Jobs\FluidbookImagesPreprocess; use App\Jobs\FluidbookSocialImage; use App\Jobs\GenerateDeliveryThumbnailsPreview; +use App\Models\Base\ToolboxDownloadable; use App\Models\Base\ToolboxSettingsModel; use App\Models\Traits\CheckHash; use App\Models\Traits\PublicationSettings; @@ -112,7 +113,7 @@ class FluidbookPublication extends ToolboxSettingsModel use PublicationSettings; use PublicationTags; use SCORMVersionTrait; - use CheckHash; + use ToolboxDownloadable; public static function addOwnerClause(Builder $builder) { diff --git a/app/Models/Quiz.php b/app/Models/Quiz.php index 10db43249..3bc42e686 100644 --- a/app/Models/Quiz.php +++ b/app/Models/Quiz.php @@ -8,12 +8,11 @@ use App\Fields\QuizDevelopmentVersion; use App\Fields\SCORMVersion; use App\Http\Controllers\Admin\Operations\ChangeownerOperation; use App\Http\Controllers\Admin\Operations\Quiz\DownloadOperation; -use App\Http\Controllers\Admin\Operations\Quiz\ImportOperation; use App\Http\Controllers\Admin\Operations\Quiz\LogOperation; use App\Http\Controllers\Admin\Operations\Quiz\PreviewOperation; use App\Http\Controllers\Admin\Operations\Quiz\ReportOperation; +use App\Models\Base\ToolboxDownloadable; use App\Models\Base\ToolboxModel; -use App\Models\Traits\CheckHash; use App\Models\Traits\SCORMVersionTrait; use Cubist\Backpack\Magic\Fields\Checkbox; use Cubist\Backpack\Magic\Fields\Code; @@ -21,7 +20,6 @@ use Cubist\Backpack\Magic\Fields\FormBigSection; use Cubist\Backpack\Magic\Fields\FormSection; use Cubist\Backpack\Magic\Fields\FormSeparator; use Cubist\Backpack\Magic\Fields\FormSuperSection; -use Cubist\Backpack\Magic\Fields\Hidden; use Cubist\Backpack\Magic\Fields\SelectFromArray; use Cubist\Backpack\Magic\Fields\Text; use Cubist\Backpack\Magic\Fields\Textarea; @@ -31,7 +29,8 @@ use Spatie\MediaLibrary\MediaCollections\Models\Media; // __('!! e-Learning') class Quiz extends ToolboxModel { - use CheckHash; + use ToolboxDownloadable; + use SCORMVersionTrait; protected $table = 'quiz'; @@ -47,7 +46,7 @@ class Quiz extends ToolboxModel protected $_operations = [PreviewOperation::class, DownloadOperation::class, LogOperation::class, ReportOperation::class, ChangeownerOperation::class]; - use SCORMVersionTrait; + protected static function _getColors() { @@ -354,17 +353,6 @@ class Quiz extends ToolboxModel return parent::create($data); } - public function getFinalPath() - { - return protected_path('quiz/final/' . $this->id); - } - - public function onSaving(): bool - { - $this->checkHash(); - return parent::onSaving(); - } - public function getPreviewURL($attrs = []) { $routeName = 'quiz_preview'; diff --git a/app/Notifications/ToolboxNotification.php b/app/Notifications/ToolboxNotification.php index ac9f520fe..11f90ef1d 100644 --- a/app/Notifications/ToolboxNotification.php +++ b/app/Notifications/ToolboxNotification.php @@ -65,7 +65,7 @@ class ToolboxNotification extends Notification foreach ($this->actions as $label => $url) { $m->line(new HtmlString($label . __(': ') . ' ' . $url . '')); } - $m->salutation(new HtmlString(__('Cordialement,') . "
" . __('L\'équipe :teamname',['team_name'=>env('MAIL_TEAM_NAME')]))); + $m->salutation(new HtmlString(__('Cordialement,') . "
" . __('L\'équipe :teamname', ['teamname' => env('MAIL_TEAM_NAME')]))); return $m; }