{"id":28398670,"url":"https://github.com/inpin/lara-like","last_synced_at":"2025-06-28T18:31:56.876Z","repository":{"id":56991903,"uuid":"107395044","full_name":"inpin/lara-like","owner":"inpin","description":"Trait for Laravel Eloquent models to allow easy implementation of a \"like\" or \"favorite\" or \"remember\" or what ever you want features.","archived":false,"fork":false,"pushed_at":"2018-06-05T11:24:06.000Z","size":18,"stargazers_count":5,"open_issues_count":0,"forks_count":1,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-06-01T13:54:16.495Z","etag":null,"topics":["bookmark","composer","eloquent","favorite","laralike","laravel","like","likeable","model","package","seen","trait"],"latest_commit_sha":null,"homepage":"http://inpinapp.com","language":"PHP","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/inpin.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2017-10-18T10:50:40.000Z","updated_at":"2020-05-10T05:32:01.000Z","dependencies_parsed_at":"2022-08-21T09:10:26.559Z","dependency_job_id":null,"html_url":"https://github.com/inpin/lara-like","commit_stats":null,"previous_names":[],"tags_count":6,"template":false,"template_full_name":null,"purl":"pkg:github/inpin/lara-like","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/inpin%2Flara-like","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/inpin%2Flara-like/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/inpin%2Flara-like/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/inpin%2Flara-like/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/inpin","download_url":"https://codeload.github.com/inpin/lara-like/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/inpin%2Flara-like/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":262476173,"owners_count":23317227,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["bookmark","composer","eloquent","favorite","laralike","laravel","like","likeable","model","package","seen","trait"],"created_at":"2025-06-01T05:39:06.041Z","updated_at":"2025-06-28T18:31:56.870Z","avatar_url":"https://github.com/inpin.png","language":"PHP","funding_links":[],"categories":[],"sub_categories":[],"readme":"LaraLike\n============\nImportant note: this product is forked and edited from base [laravel-likeable](https://github.com/rtconner/laravel-likeable) package.\n\n[![Build Status](https://travis-ci.org/inpin/lara-like.svg?branch=master)](https://travis-ci.org/inpin/lara-like)\n[![StyleCI](https://styleci.io/repos/107395044/shield?branch=master)](https://styleci.io/repos/107395044)\n[![Maintainability](https://api.codeclimate.com/v1/badges/1283cd874bf869977edf/maintainability)](https://codeclimate.com/github/inpin/lara-like/maintainability)\n[![Latest Stable Version](https://poser.pugx.org/inpin/lara-like/v/stable)](https://packagist.org/packages/inpin/lara-like)\n[![Total Downloads](https://poser.pugx.org/inpin/lara-like/downloads)](https://packagist.org/packages/inpin/lara-like)\n[![Latest Unstable Version](https://poser.pugx.org/inpin/lara-like/v/unstable)](https://packagist.org/packages/inpin/lara-like)\n[![License](https://poser.pugx.org/inpin/lara-like/license)](https://packagist.org/packages/inpin/lara-like)\n\nTrait for Laravel Eloquent models to allow easy implementation of a \"like\" or \"favorite\" or \"remember\" or what ever you want features.\n\n#### Composer Install (for Laravel 5.5 and above)\n\n\tcomposer require inpin/lara-like\n\n#### Install and then run the migrations\n\n```php\n'providers' =\u003e [\n    \\Inpin\\LaraLike\\LaraLikeServiceProvider::class,\n],\n```\n\n```bash\nphp artisan vendor:publish --provider=\"Inpin\\LaraLike\\LaraLikeServiceProvider\" --tag=migrations\nphp artisan migrate\n```\n\n#### Setup your models\n\n```php\nclass Book extends \\Illuminate\\Database\\Eloquent\\Model {\n    use Inpin\\LaraLike\\Likeable;\n}\n```\n\n#### Sample Usage\n\n```php\n$book-\u003elike(); // like the book for current user\n$book-\u003elike($user); // pass in your own user\n$book-\u003elike(0); // just add likes to the count, and don't track by user\n$book-\u003elike('api'); // like the book for current user with guard 'api'\n$book-\u003elike(null, 'bookmark') // add book for current user to bookmarks\n$book-\u003elike($user, 'bookmark') // pass user and type\n\n$book-\u003eunlike(); // remove like from the book\n$book-\u003eunlike($user); // pass in your own user id\n$book-\u003eunlike(0); // remove likes from the count -- does not check for user\n$book-\u003eunlike('api'); // remove like from book for current user with guard 'api'\n$book-\u003eunlike(null, 'bookmark') // remove current book from current user bookmarks\n$book-\u003eunlike($user, 'bookmark') // pass user and type\n\n$book-\u003elikes; // Iterable Illuminate\\Database\\Eloquent\\Collection of existing likes \n$book-\u003elikes()-\u003ewhere('type', 'bookmark')\n\n$book-\u003eliked(); // check if currently logged in user liked the book\n$book-\u003eliked($myUserId);\n\n$book-\u003elikeCount($type); // determine number of likes for given $type (default type is 'like')\n\nArticle::whereLikedBy($myUserId) // find only books where user liked them\n\t-\u003ewith('likeCounter') // highly suggested to allow eager load\n\t-\u003eget();\n```\nnote: default type is 'like'.\n\n#### Credits\n\n - Mohammad Nourinik - http://inpinapp.com\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Finpin%2Flara-like","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Finpin%2Flara-like","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Finpin%2Flara-like/lists"}