Enable __set() in Jobs, so all data is stored in _data

This commit is contained in:
Deon George 2022-09-04 13:52:49 +10:00
parent 4ff944cb3a
commit 15a6933026
3 changed files with 9 additions and 5 deletions

View File

@ -22,16 +22,16 @@ final class DeleteChat extends Job
public function __construct(Model $o,string $ts) public function __construct(Model $o,string $ts)
{ {
if ($o instanceof Channel) { if ($o instanceof Channel) {
$this->_data['cid'] = $o->channel_id; $this->cid = $o->channel_id;
} elseif ($o instanceof User) { } elseif ($o instanceof User) {
$this->_data['cid'] = $o->user_id; $this->cid = $o->user_id;
} else } else
throw new \Exception('Invalid Model: '.get_class($o)); throw new \Exception('Invalid Model: '.get_class($o));
$this->_data['to'] = $o->team; $this->to = $o->team;
$this->_data['ts'] = $ts; $this->ts = $ts;
} }
/** /**

View File

@ -29,4 +29,8 @@ abstract class Job implements ShouldQueue
{ {
return Arr::get($this->_data,$key); return Arr::get($this->_data,$key);
} }
public function __set(string $key,$value) {
return $this->_data->put($key,$value);
}
} }

View File

@ -18,7 +18,7 @@ class TeamUpdate extends Job
*/ */
public function __construct(Team $to) public function __construct(Team $to)
{ {
$this->_data['to'] = $to; $this->to = $to;
} }
public function handle() public function handle()