函数App \ Http \ Controllers \ homepageController :: edit_web_services()的参数太少,传递了0个且正好是1个

时间:2019-02-23 08:56:49

标签: laravel

我的功能

public function post_sofware_technology(Request $request)
{
    $titile = $request->input('category_title');
    $excerpt = $request->input('Excerpt');
    $post = new posts();
    $post->post_title = $titile;
    $post->post_excerpt = $excerpt;

    $post->save();
    $soft_id = $post->id;
    $this->edit_web_services($soft_id);
}

另一个功能

public function edit_web_services($soft_id)
{
    $soft = $soft_id;
    dd($soft);
}

我想将我的$soft_id = $post->id;值从post_sofware_technology()方法传递到同一控制器内的edit_web_services($soft_id)

1 个答案:

答案 0 :(得分:0)

尝试

public function post_sofware_technology(Request $request)
{
    $titile = $request->input('category_title');
    $excerpt = $request->input('Excerpt');
    $post = new posts();
    $post->post_title = $titile;
    $post->post_excerpt = $excerpt;

    $post->save();
    $soft_id = $post->id;
    return $this->edit_web_services($soft_id);
}