Browse Source

Import update date

pull/3/head
Wahyu Ramadhan 1 year ago
parent
commit
8ee23fdcf5
  1. 11
      app/Http/Controllers/ActivityController.php
  2. 1
      routes/web.php

11
app/Http/Controllers/ActivityController.php

@ -776,4 +776,15 @@ class ActivityController extends Controller
} }
return response()->json(['status'=>'failed','message'=>'File is required!','code'=>400], 400); return response()->json(['status'=>'failed','message'=>'File is required!','code'=>400], 400);
} }
public function importUpdate(Request $request) {
$data = $request->all();
foreach ($data as $value) {
$activity = Activity::find($value['id']);
$activity->start_date = $value['start_date'];
$activity->end_date = $value['end_date'];
$activity->save();
}
return response()->json(['status'=>'success','data'=>$request,'message'=>'Update successful!','code'=>200], 200);
}
} }

1
routes/web.php

@ -202,6 +202,7 @@ $router->group(['prefix'=>'api', 'middleware' => 'cors'], function () use ($rout
$router->get('/activity/{id}/{proyek_id}/get', 'ActivityController@getByGanttId'); $router->get('/activity/{id}/{proyek_id}/get', 'ActivityController@getByGanttId');
$router->get('/activity/search', 'ActivityController@search'); $router->get('/activity/search', 'ActivityController@search');
$router->post('/activity/import', 'ActivityController@import'); $router->post('/activity/import', 'ActivityController@import');
$router->post('/activity/import-update', 'ActivityController@importUpdate');
$router->post('/activity/import-old', 'ActivityController@importOld'); $router->post('/activity/import-old', 'ActivityController@importOld');
$router->post('/task', 'ActivityController@add'); $router->post('/task', 'ActivityController@add');
$router->get('/task/edit/{id}', 'ActivityController@edit'); $router->get('/task/edit/{id}', 'ActivityController@edit');

Loading…
Cancel
Save