【发布时间】:2017-04-05 16:20:39
【问题描述】:
我想从名为 post 的表中删除一条记录。在我看来,我正在发送一个名为 tag 的参数,以删除针对该标记的某个记录。 所以这是我的路线
Route::get('/delete' , array('as' =>'delete' , 'uses' => 'Postcontroller@deletepost'));
通过这条路线,我将针对它的“标签”字段删除我的帖子。我的桌子有两列。一个是标签,另一个是内容 我在 PostController 中的删除功能是
public function deletepost($tag){
$post = post::find($tag); //this is line 28 in my fuction
$post->delete();
echo ('record is deleted') ;
}
我从我的视图中发送标签,但它给出了以下错误
ErrorException in Postcontroller.php line 28:
Missing argument 1 for
App\Http\Controllers\Postcontroller::deletepost()
【问题讨论】:
标签: php laravel-5.3