/** * Dispatch a job to record the model's activity. * * @param SnapShot $snapShot * @return void */ public static function saveSnapShot(SnapShot $snapShot) { if (config('model-time-machine.queue.enabled')) { return app(Dispatcher::class)->dispatch((new CreateSnapShot($snapShot->toArray()))->onConnection(config('model-time-machine.queue.connection'))->onQueue(config('model-time-machine.queue.name'))); } return app(Dispatcher::class)->dispatchNow(new CreateSnapShot($snapShot->toArray())); }
/** * Create a new SnapShot. * * @return void */ public function handle() { return SnapShot::create(array_filter($this->snapShot)); }