Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- class UpdateTournamentCurrentSeason
- {
- /**
- * @param Tournament $tournament
- * @return bool
- * @throws \Throwable
- */
- public function __invoke(Tournament $tournament)
- {
- DB::beginTransaction();
- try {
- $this->setTournament($tournament);
- $this->parseInfo();
- if ($this->oldSeasonId != $this->newSeasonId) {
- $newTeams = $this->updateTeams();
- if ($newTeams) {
- $this->dispatchMatches();
- DB::commit();
- return true;
- }
- }
- } catch (\Exception $exception) {
- DB::rollBack();
- throw $exception;
- } catch (\Throwable $throwable) {
- DB::rollBack();
- throw $throwable;
- }
- // тут долно быть DB::rollBack();
- return false;
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement