-
Notifications
You must be signed in to change notification settings - Fork 2
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 #41 from Roxayl/develop
Historique modifs page pays, ville et organisation
- Loading branch information
Showing
39 changed files
with
641 additions
and
185 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
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,45 @@ | ||
<?php | ||
|
||
namespace Roxayl\MondeGC\Console\Commands; | ||
|
||
use Illuminate\Console\Command; | ||
use Roxayl\MondeGC\Services\RegenerateInfluenceService; | ||
|
||
class RegenerateInfluences extends Command | ||
{ | ||
/** | ||
* The name and signature of the console command. | ||
* | ||
* @var string | ||
*/ | ||
protected $signature = 'monde:regenerate-influences'; | ||
|
||
/** | ||
* The console command description. | ||
* | ||
* @var string | ||
*/ | ||
protected $description = "Régénère les influences générées par les entités influençables."; | ||
|
||
/** | ||
* Execute the console command. | ||
* | ||
* @param RegenerateInfluenceService $regenerateInfluenceService | ||
* @return int | ||
*/ | ||
public function handle(RegenerateInfluenceService $regenerateInfluenceService): int | ||
{ | ||
try { | ||
$this->line('Régénération des influences (' | ||
. $regenerateInfluenceService->influenceCount() . ' influence(s) actuellement dans la base de données)...'); | ||
$regenerateInfluenceService->regenerate(); | ||
$this->info('Influences regénérées avec succès (' | ||
. $regenerateInfluenceService->influenceCount() . ' influence(s) actuellement dans la base de données).'); | ||
} | ||
catch (\Throwable $ex) { | ||
$this->error("Une erreur s'est produite : " . $ex->getMessage()); | ||
return 1; | ||
} | ||
return 0; | ||
} | ||
} |
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,56 @@ | ||
<?php | ||
|
||
namespace Roxayl\MondeGC\Http\Controllers; | ||
|
||
use Illuminate\Support\Facades\Gate; | ||
use Illuminate\View\View; | ||
use Mpociot\Versionable\Version; | ||
use Roxayl\MondeGC\Models\Pays; | ||
use Roxayl\MondeGC\Services\VersionDiffService; | ||
|
||
class PaysController extends Controller | ||
{ | ||
/** | ||
* @param Pays $pays | ||
* @return View | ||
*/ | ||
public function history(Pays $pays): View | ||
{ | ||
$versions = $pays->versions()->latest('version_id')->paginate(); | ||
$canRevert = Gate::allows('revert', $pays); | ||
$title = 'Historique du pays ' . $pays->ch_pay_nom; | ||
$diffRoute = 'pays.diff'; | ||
$breadcrumb = view('pays.components.history-breadcrumb', compact('pays')); | ||
|
||
return view( | ||
'version.history', | ||
compact('title', 'breadcrumb', 'versions', 'canRevert', 'diffRoute') | ||
); | ||
} | ||
|
||
/** | ||
* Compare deux versions d'un pays. | ||
* | ||
* @param VersionDiffService $diffService | ||
* @param Version $version1 | ||
* @param Version|null $version2 | ||
* @return View | ||
*/ | ||
public function diff(VersionDiffService $diffService, Version $version1, ?Version $version2 = null): View | ||
{ | ||
$this->authorize('viewAny', Pays::class); | ||
|
||
/** @var Pays $model1 */ | ||
/** @var Pays $model2 */ | ||
$model1 = $version1->getModel(); | ||
if($version2 === null) { | ||
$model2 = new ($model1::class); | ||
} else { | ||
$model2 = $version2->getModel(); | ||
} | ||
|
||
$diffs = $diffService->generate($model1, $model2); | ||
|
||
return view('version.diff', compact('diffs')); | ||
} | ||
} |
Oops, something went wrong.