格式化代码
This commit is contained in:
parent
7e76bb574b
commit
763a40d154
@ -5,17 +5,16 @@
|
||||
use App\Http\Controllers\Controller;
|
||||
use App\Models\WorkOrder\Reply;
|
||||
use App\Models\WorkOrder\WorkOrder;
|
||||
use function auth;
|
||||
use Illuminate\Http\JsonResponse;
|
||||
use Illuminate\Http\Request;
|
||||
use function auth;
|
||||
|
||||
class ReplyController extends Controller
|
||||
{
|
||||
/**
|
||||
* Display a listing of the resource.
|
||||
*
|
||||
* @param WorkOrder $workOrder
|
||||
*
|
||||
* @param WorkOrder $workOrder
|
||||
* @return JsonResponse
|
||||
*/
|
||||
public function index(WorkOrder $workOrder): JsonResponse
|
||||
@ -28,9 +27,8 @@ public function index(WorkOrder $workOrder): JsonResponse
|
||||
/**
|
||||
* Store a newly created resource in storage.
|
||||
*
|
||||
* @param Request $request
|
||||
* @param WorkOrder $workOrder
|
||||
*
|
||||
* @param Request $request
|
||||
* @param WorkOrder $workOrder
|
||||
* @return JsonResponse
|
||||
*/
|
||||
public function store(Request $request, WorkOrder $workOrder): JsonResponse
|
||||
@ -44,7 +42,7 @@ public function store(Request $request, WorkOrder $workOrder): JsonResponse
|
||||
}
|
||||
|
||||
// 如果工单已经关闭,那么访客不能回复
|
||||
if ($workOrder->isClosed() && !auth('sanctum')->check()) {
|
||||
if ($workOrder->isClosed() && ! auth('sanctum')->check()) {
|
||||
return $this->error('工单已关闭,无法进行回复。');
|
||||
}
|
||||
|
||||
|
@ -47,17 +47,17 @@ public function handle(): void
|
||||
|
||||
if ($this->type == 'post') {
|
||||
$response = $this->workOrder->module->http()->post('work-orders', $this->workOrder->toArray());
|
||||
} else if ($this->type == 'put') {
|
||||
$response = $this->workOrder->module->http()->put('work-orders/' . $this->workOrder->id, $this->workOrder->toArray());
|
||||
} elseif ($this->type == 'put') {
|
||||
$response = $this->workOrder->module->http()->put('work-orders/'.$this->workOrder->id, $this->workOrder->toArray());
|
||||
} else {
|
||||
$response = $this->workOrder->module->http()->delete('work-orders/' . $this->workOrder->id);
|
||||
$response = $this->workOrder->module->http()->delete('work-orders/'.$this->workOrder->id);
|
||||
|
||||
if ($response->successful()) {
|
||||
$this->workOrder->delete();
|
||||
}
|
||||
}
|
||||
|
||||
if (!$response->successful()) {
|
||||
if (! $response->successful()) {
|
||||
Log::debug('WorkOrder push failed', [
|
||||
'type' => $this->type,
|
||||
'response' => $response->json(),
|
||||
|
@ -155,6 +155,7 @@ public function safeDelete(): bool
|
||||
} else {
|
||||
dispatch(new WorkOrderJob($this, 'delete'));
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user