Merge pull request #373 from JoeForks/feature/api-delete
Implement API deletes
This commit is contained in:
@@ -25,5 +25,9 @@ Route::api(['after' => 'allowed_domains', 'namespace' => 'CachetHQ\Cachet\Http\C
|
||||
Route::put('components/{id}', 'ComponentController@putComponent');
|
||||
Route::put('incidents/{id}', 'IncidentController@putIncident');
|
||||
Route::put('metrics/{id}', 'MetricController@putMetric');
|
||||
|
||||
Route::delete('components/{id}', 'ComponentController@deleteComponent');
|
||||
Route::delete('incidents/{id}', 'IncidentController@deleteIncident');
|
||||
Route::delete('metrics/{id}', 'MetricController@deleteMetric');
|
||||
});
|
||||
});
|
||||
|
||||
@@ -73,4 +73,18 @@ class ComponentController extends Controller
|
||||
{
|
||||
return $this->component->create($this->auth->user()->id, Binput::all());
|
||||
}
|
||||
|
||||
/**
|
||||
* Delete an existing component.
|
||||
*
|
||||
* @param int $id
|
||||
*
|
||||
* @return \Dingo\Api\Http\Response
|
||||
*/
|
||||
public function deleteComponent($id)
|
||||
{
|
||||
$this->component->destroy($id);
|
||||
|
||||
return $this->response->noContent();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -73,4 +73,18 @@ class IncidentController extends Controller
|
||||
{
|
||||
return $this->incident->update($id, Binput::all());
|
||||
}
|
||||
|
||||
/**
|
||||
* Delete an existing incident.
|
||||
*
|
||||
* @param int $id
|
||||
*
|
||||
* @return \Dingo\Api\Http\Response
|
||||
*/
|
||||
public function deleteIncident($id)
|
||||
{
|
||||
$this->incident->destroy($id);
|
||||
|
||||
return $this->response->noContent();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -72,4 +72,18 @@ class MetricController extends Controller
|
||||
{
|
||||
return $this->metric->update($id, Binput::all());
|
||||
}
|
||||
|
||||
/**
|
||||
* Delete an existing metric.
|
||||
*
|
||||
* @param int $id
|
||||
*
|
||||
* @return \Dingo\Api\Http\Response
|
||||
*/
|
||||
public function deleteMetric($id)
|
||||
{
|
||||
$this->metric->destroy($id);
|
||||
|
||||
return $this->response->noContent();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -121,7 +121,7 @@ abstract class EloquentRepository
|
||||
*/
|
||||
public function destroy($id)
|
||||
{
|
||||
$this->model->delete($id);
|
||||
$this->model->destroy($id);
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
Reference in New Issue
Block a user