/**
* Store collection
* @param Collection $collection
*/
private function storeCollection(Collection $collection)
{
Cache::flush($this->getCacheQuequeMask());
if (config('lauser.save_type') == 'file') {
$path = $this->getLaUserFilePathById($this->id);
Storage::put($path, $collection->toJson());
} else {
$isExists = DB::table(config('lauser.save_table'))->where('user_id', $this->id)->count();
if ($isExists > 0) {
DB::table(config('lauser.save_table'))->where('user_id', $this->id)->update(['json' => $collection->toJson()]);
} else {
DB::table(config('lauser.save_table'))->insert(['user_id' => $this->id, 'json' => $collection->toJson()]);
}
}
}