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 !
from Newest questions tagged laravel-5 - Stack Overflow http://ift.tt/2naukgo
via IFTTT
Aucun commentaire:
Enregistrer un commentaire