| @@ 183-191 (lines=9) @@ | ||
| 180 | return abort(403); | |
| 181 | } | |
| 182 | ||
| 183 |         if (! config('laravel-tickets.open-ticket-with-answer') && $ticket->state === 'CLOSED') { | |
| 184 |             $message = trans('You cannot reply to a closed ticket'); | |
| 185 | return \request()->wantsJson() ? | |
| 186 |                 response()->json(compact('message')) : | |
| 187 | back()->with( | |
| 188 | 'message', | |
| 189 | $message | |
| 190 | ); | |
| 191 | } | |
| 192 | ||
| 193 | $data = $request->validate([ | |
| 194 | 'message' => [ 'required', 'string' ], | |
| @@ 236-244 (lines=9) @@ | ||
| 233 |         if (! $ticket->user()->get()->contains(\request()->user())) { | |
| 234 | return abort(403); | |
| 235 | } | |
| 236 |         if ($ticket->state === 'CLOSED') { | |
| 237 |             $message = trans('The ticket is already closed'); | |
| 238 | return \request()->wantsJson() ? | |
| 239 |                 response()->json(compact('message')) : | |
| 240 | back()->with( | |
| 241 | 'message', | |
| 242 | $message | |
| 243 | ); | |
| 244 | } | |
| 245 | $ticket->update([ 'state' => 'CLOSED' ]); | |
| 246 | event(new TicketCloseEvent($ticket)); | |
| 247 | ||