From 15a69330262a2576010f1d01a328dfdaa8ecb922 Mon Sep 17 00:00:00 2001 From: Deon George Date: Sun, 4 Sep 2022 13:52:49 +1000 Subject: [PATCH] Enable __set() in Jobs, so all data is stored in _data --- src/Jobs/DeleteChat.php | 8 ++++---- src/Jobs/Job.php | 4 ++++ src/Jobs/TeamUpdate.php | 2 +- 3 files changed, 9 insertions(+), 5 deletions(-) diff --git a/src/Jobs/DeleteChat.php b/src/Jobs/DeleteChat.php index 46d277f..bc492d6 100644 --- a/src/Jobs/DeleteChat.php +++ b/src/Jobs/DeleteChat.php @@ -22,16 +22,16 @@ final class DeleteChat extends Job public function __construct(Model $o,string $ts) { if ($o instanceof Channel) { - $this->_data['cid'] = $o->channel_id; + $this->cid = $o->channel_id; } elseif ($o instanceof User) { - $this->_data['cid'] = $o->user_id; + $this->cid = $o->user_id; } else throw new \Exception('Invalid Model: '.get_class($o)); - $this->_data['to'] = $o->team; - $this->_data['ts'] = $ts; + $this->to = $o->team; + $this->ts = $ts; } /** diff --git a/src/Jobs/Job.php b/src/Jobs/Job.php index 45c47c3..fc8bb95 100644 --- a/src/Jobs/Job.php +++ b/src/Jobs/Job.php @@ -29,4 +29,8 @@ abstract class Job implements ShouldQueue { return Arr::get($this->_data,$key); } + + public function __set(string $key,$value) { + return $this->_data->put($key,$value); + } } \ No newline at end of file diff --git a/src/Jobs/TeamUpdate.php b/src/Jobs/TeamUpdate.php index a057e49..8edf122 100644 --- a/src/Jobs/TeamUpdate.php +++ b/src/Jobs/TeamUpdate.php @@ -18,7 +18,7 @@ class TeamUpdate extends Job */ public function __construct(Team $to) { - $this->_data['to'] = $to; + $this->to = $to; } public function handle()