2015-09-15 103 views
0

這裏是我的ContactController.php:MethodNotAllowedHttpException laravel 4.2錯誤

public function destroy($id){ 
    $contact = Contact::find($id); 
    $contact->delete(); 
    return Redirect::to('http://localhost:8000/contactsview'); 
} 

這裏是我的rountes.php

Route::delete('/contactsview/destroy/{id}', array('uses'=>'[email protected]')); 

這裏是我的index.blade.php:

{{ Form::open(array('url'=>'/contactsview/delete/'.$contact->id, 'method'=>'DELETE', 'style'=>'display:inline;')) }} 
<!-- {{ Form::hidden('id', $contact->id) }} --> 
{{ Form::submit('Delete') }} 
{{ Form::close() }} 

我做錯了什麼?

回答

0

嘗試的形式與此相反,在$contact->id傳遞作爲PARAM,而不是直接在網址:

{{ Form::open(array('method' => 'DELETE', 'action' => array('[email protected]', $contact->id)) }} 
相關問題