| @@ 176-184 (lines=9) @@ | ||
| 173 | return abort(403); |
|
| 174 | } |
|
| 175 | ||
| 176 | if (! config('laravel-tickets.open-ticket-with-answer') && $ticket->state === 'CLOSED') { |
|
| 177 | $message = trans('You cannot reply to a closed ticket'); |
|
| 178 | return \request()->wantsJson() ? |
|
| 179 | response()->json(compact('message')) : |
|
| 180 | back()->with( |
|
| 181 | 'message', |
|
| 182 | $message |
|
| 183 | ); |
|
| 184 | } |
|
| 185 | ||
| 186 | $data = $request->validate([ |
|
| 187 | 'message' => [ 'required', 'string' ], |
|
| @@ 229-237 (lines=9) @@ | ||
| 226 | if (! $ticket->user()->get()->contains(\request()->user())) { |
|
| 227 | return abort(403); |
|
| 228 | } |
|
| 229 | if ($ticket->state === 'CLOSED') { |
|
| 230 | $message = trans('The ticket is already closed'); |
|
| 231 | return \request()->wantsJson() ? |
|
| 232 | response()->json(compact('message')) : |
|
| 233 | back()->with( |
|
| 234 | 'message', |
|
| 235 | $message |
|
| 236 | ); |
|
| 237 | } |
|
| 238 | $ticket->update([ 'state' => 'CLOSED' ]); |
|
| 239 | event(new TicketCloseEvent($ticket)); |
|
| 240 | ||