/** * 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())); }