samedi 26 novembre 2016

Passing data from view to controller in Laravel 5.1

i want to pass arguments from a blade view to a function in the controller

index.blade.php

<a href="" class="like">
    Like
</a>

<a href="" class="like">
    Dislike
</a>

PostController.php

  public function getLikePost($post_id, $like_value)
    {
       $post = Post::find($post_id);
       ...
    }

routes.php

Route::get('like', [
        'uses' => 'PostController@getLikePost',
        'as'   => 'like'
      ]);

but i get an error message

ErrorException in PostController.php line 149:
Missing argument 2 for App\Http\Controllers\PostController::getLikePost()

could anyone help me with this issue?



via Chebli Mohamed

Aucun commentaire:

Enregistrer un commentaire