定义对象Laravel

I have a page which has numerous articles. I want to give the user the ability to 'like' an article and to store that like id into a database for reuse later. Im new to Laravel and Php, so here is what i have.

I have models for Article and the Like. and i have this in the public store ArticleController.

public function store()
{
    $article = new Article();
    $article->body = 'new article body';
    $article->title = 'new article Title';
    $article->type = 'fashion';

    $article->save();

    $request = Request::all();

    $likes = new Like();
    $likes->user_id = Auth::user()->id;
    $likes->article_id = $article->id;
    $likes->save();

    return redirect('article');



}

I followed the tutorial on laravel fundamentals but i think i missed something. This is working for me here. But now i want to change it so that it only takes the existing article and does not make a new one. When i change it to reflect this:

$article = Article::find($id);

It tells me that the $id is not defined. So how do i make $id point to the article the user wants to 'like'?

The question is So how do i make $id point to the article the user wants to 'like'?

This is quite a big/broad question but I'll try to sumarize. At first you need a route for that, for example:

Route::get('article/like/{id}', 'ArticleController@like');

Then in your ArticleController declare the like method, for example:

public function like($id)
{
    // Now you can use $id
}

To clarify you, {id} in the route will take the id of the article from the URI so you may use a URI like this:

http://example.com/article/like/10 // Here 10 is the article id

So this was the idea, now implement it and modify the URI or what ever you need to make it fit in your project but remember that, if you want to pass an id to your URI then you have to use a route parameter (i.e: {id} in this case) when declaring the route and your method should recieve that parameter using an argument in the method header, i.e: public function like($id).