| 1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889 |
- <?php
- namespace App\Http\Controllers;
- use App\WorkOrderProcessLog;
- use Illuminate\Http\Request;
- use Illuminate\Support\Facades\Auth;
- class WorkOrderProcessLogController extends Controller
- {
- public function index()
- {
- //
- }
- public function create()
- {
- //
- }
- public function store(Request $request)
- {
- //
- }
- public function show(WorkOrderProcessLog $workOrderProcessLog)
- {
- //
- }
- public function edit(WorkOrderProcessLog $workOrderProcessLog)
- {
- //
- }
- public function update(Request $request, WorkOrderProcessLog $workOrderProcessLog)
- {
- //
- }
- public function destroy(WorkOrderProcessLog $workOrderProcessLog)
- {
- //
- }
- public function logisticStoreApi(Request $request): array
- {
- $isExists = WorkOrderProcessLog::query()
- ->where('work_order_id',$request->input('work_order_id'))
- ->where('type','2')->exists();
- if ($isExists){
- return ['success' => false,'message' => '对应处理日志已存在'];
- }
- $params = $request->all();
- $params['creator_id'] = Auth::user()['id'];
- $params['type'] = '2';
- $log = WorkOrderProcessLog::query()->create($params);
- $log->loadMissing('creator');
- return ['success' => true , 'data' => $log];
- }
- public function storeApi(Request $request): array
- {
- $isExists = WorkOrderProcessLog::query()
- ->where('work_order_id',$request->input('work_order_id'))
- ->where('type',1)->exists();
- if ($isExists){
- return ['success' => false,'message' => '对应处理日志已存在'];
- }
- $params = $request->all();
- $params['creator_id'] = Auth::user()['id'];
- $params['type'] = 1;
- $log = WorkOrderProcessLog::query()->create($params);
- $log->loadMissing('creator');
- return ['success' => true , 'data' => $log];
- }
- public function updateApi(Request $request): array
- {
- $log = WorkOrderProcessLog::query()
- ->where('id',$request->input('id'))->first();
- $params = $request->all();
- $params['creator_id'] = Auth::user()['id'];
- $log->update($params);
- return ['success' => true,'data' =>$log];
- }
- }
|