mardi 28 août 2018

function () does not exit in laravel 5.6

Here i am use the resource route. Now I need to add more one route, do that like,

`Route::resource('discussion', 'DiscussionsController');
Route::post('/discussion/reply/{id}',[
    'use' => 'DiscussionsController@reply',
    'as' => 'discussion.reply'
]);`

And here is reply function,

public function reply($id)
{
    $discussion = Discussion::find($id);

    $reply = Reply::create([
        'user_id'=>Auth::id(),
        'discussion_id' => $id,
        'content'=> \request()->reply
    ]);

    return redirect()->back();
}

here is form for store

<div class="card">

    <div class="card-body">
        Leave a reply

        <form method="post" action="">
            
            <div class="form-group">
                <textarea name="reply" class="form-control"></textarea>
            </div>

            <div class="form-group">
                <button type="submit" class="btn btn-primary ">Reply</button>
            </div>
        </form>
    </div>

Where is the problem, i can't got it



via Chebli Mohamed

Aucun commentaire:

Enregistrer un commentaire