Browse Source

query ProjectController@edit

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

9
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);
}
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);
$result = Project::find($id);
$result = Project::query()
->select(array_diff(DB::getSchemaBuilder()->getColumnListing('m_proyek'), ['created_by', 'created_at', 'updated_at', 'updated_by', 'scurve']))
->whereId($id)
->first();
if(!$result)
return response()->json(['status'=>'failed','message'=> 'Data not found!','code'=> 404], 404);

Loading…
Cancel
Save