I would like to know why I have a "Not Allowed" method in this case. I'm trying to set a value to NULL (I have an hasClone column) when I delete an entry that I duplicated.
My controller :
public function destroyChanges($id)
{
$activity = Activity::findOrFail($id);
$activity->delete();
return redirect()->to('/admin/activity/setCloneNull/' . $activity->parent_id);
}
public function setCloneNull($id, Activity $activity)
{
$activity = $activity->where('id', '=', $id)->first();
$activity->hasClone = NULL;
$activity->save();
return redirect(url('/admin/activity/'));
}
Routes :
Route::delete('activity/destroyChanges/{id}', ['as' => 'cancel.activity', 'uses' => 'ActivityCrudController@destroyChanges']);
Route::post('activity/setCloneNull/{id}', ['as' => 'setCloneNull.activity', 'uses' => 'ActivityCrudController@setCloneNull']);
How to make it work? thank you !
via Chebli Mohamed
Aucun commentaire:
Enregistrer un commentaire