From 3b6b78423e1e485e7a93b7ee62168605787d668f Mon Sep 17 00:00:00 2001 From: Kirito Date: Sat, 31 Aug 2024 16:33:19 +0200 Subject: [PATCH] feat: add RunsArtisan Trait (#42) - Added RunsArtisan trait - Update `run_by` assignment to use `getArtisanRunByName` method --- CHANGELOG.md | 4 ++++ src/Dto/RunDto.php | 6 +++++- src/Traits/RunsArtisan.php | 16 ++++++++++++++++ 3 files changed, 25 insertions(+), 1 deletion(-) create mode 100644 src/Traits/RunsArtisan.php diff --git a/CHANGELOG.md b/CHANGELOG.md index 6226162..0fa7eea 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,9 @@ # Release Notes +## [4.4.0](#) +- Added `Stepanenko3\NovaCommandRunner\Traits\RunsArtisan` +- Update `run_by` assignment to use the `getArtisanRunByName` method + ## [4.1.0](#) - `Stepanenko3\NovaCommandRunner\CommandRunner` migrate to `Stepanenko3\NovaCommandRunner\CommandRunnerTool` diff --git a/src/Dto/RunDto.php b/src/Dto/RunDto.php index 75ab56a..3ebabe4 100644 --- a/src/Dto/RunDto.php +++ b/src/Dto/RunDto.php @@ -24,7 +24,11 @@ class RunDto public function __construct() { - $this->run_by = auth()->check() ? auth()->user()->name : ''; + if (auth()->check() && method_exists(auth()->user(), 'getArtisanRunByName')) { + $this->run_by = auth()->user()->getArtisanRunByName(); + } else { + $this->run_by = __('unknown'); + } $this->id = uniqid(); } diff --git a/src/Traits/RunsArtisan.php b/src/Traits/RunsArtisan.php new file mode 100644 index 0000000..a9a76b2 --- /dev/null +++ b/src/Traits/RunsArtisan.php @@ -0,0 +1,16 @@ +name; + } +}