Code Coverage |
||||||||||
Lines |
Functions and Methods |
Classes and Traits |
||||||||
| Total | |
0.00% |
0 / 7 |
|
0.00% |
0 / 1 |
CRAP | |
0.00% |
0 / 1 |
| IncrementShortcutVersion | |
0.00% |
0 / 7 |
|
0.00% |
0 / 1 |
2 | |
0.00% |
0 / 1 |
| handle | |
0.00% |
0 / 7 |
|
0.00% |
0 / 1 |
2 | |||
| 1 | <?php |
| 2 | |
| 3 | namespace App\Listeners\Business; |
| 4 | |
| 5 | use App\Events\Business\ShortcutUpdated; |
| 6 | use App\Http\Models\Setting; |
| 7 | use Illuminate\Contracts\Queue\ShouldQueue; |
| 8 | use Illuminate\Support\Facades\Cache; |
| 9 | |
| 10 | class IncrementShortcutVersion implements ShouldQueue |
| 11 | { |
| 12 | public function handle(ShortcutUpdated $event): void |
| 13 | { |
| 14 | $userId = $event->user->id; |
| 15 | $searchArray = ['user_id' => $userId]; |
| 16 | $settings = Setting::where($searchArray)->first(); |
| 17 | |
| 18 | $data = ['shortcut_version' => round($settings->shortcut_version + 0.001, 3)]; |
| 19 | Setting::where($searchArray)->update($data); |
| 20 | |
| 21 | Cache::forget('setting_'.$userId); |
| 22 | Cache::forget('setting_details_'.$userId); |
| 23 | } |
| 24 | } |