Browse Source

query ProjectController@edit

pull/3/head
wahyuun 1 year ago
parent
commit
dcede1f72a
  1. 13
      app/Http/Controllers/ProjectController.php

13
app/Http/Controllers/ProjectController.php

@ -65,11 +65,16 @@ class ProjectController extends Controller
return response()->json(['status'=>'success','message'=>'Data added!', 'data_result' =>$dataResultInsert, 'code'=> 200], 200); return response()->json(['status'=>'success','message'=>'Data added!', 'data_result' =>$dataResultInsert, 'code'=> 200], 200);
} }
public function edit($id){ public function edit($id)
if(empty($id) || !is_int((int)$id)) {
return response()->json(['status'=>'failed','message'=>'id is required!','code'=>400], 400); if (empty($id) || !is_int((int)$id))
return response()->json(['status' => 'failed', 'message' => 'id is required!', 'code' => 400], 400);
$result = Project::query()
->select(array_diff(DB::getSchemaBuilder()->getColumnListing('m_proyek'), ['created_by', 'created_at', 'updated_at', 'updated_by', 'scurve']))
->whereId($id)
->first();
$result = Project::find($id);
if(!$result) if(!$result)
return response()->json(['status'=>'failed','message'=> 'Data not found!','code'=> 404], 404); return response()->json(['status'=>'failed','message'=> 'Data not found!','code'=> 404], 404);

Loading…
Cancel
Save