{"id":20042512,"url":"https://github.com/code4mk/lara-rating","last_synced_at":"2025-05-05T08:32:34.463Z","repository":{"id":56954896,"uuid":"186011108","full_name":"code4mk/lara-rating","owner":"code4mk","description":"Rating system for laravel project","archived":false,"fork":false,"pushed_at":"2019-05-11T02:29:36.000Z","size":20,"stargazers_count":7,"open_issues_count":0,"forks_count":2,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-04-08T19:52:41.542Z","etag":null,"topics":["0devco","code4mk","laravel","rating-system"],"latest_commit_sha":null,"homepage":null,"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/code4mk.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":"2019-05-10T15:22:48.000Z","updated_at":"2021-02-23T17:00:05.000Z","dependencies_parsed_at":"2022-08-21T04:10:54.987Z","dependency_job_id":null,"html_url":"https://github.com/code4mk/lara-rating","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/code4mk%2Flara-rating","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/code4mk%2Flara-rating/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/code4mk%2Flara-rating/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/code4mk%2Flara-rating/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/code4mk","download_url":"https://codeload.github.com/code4mk/lara-rating/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":252466898,"owners_count":21752459,"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":["0devco","code4mk","laravel","rating-system"],"created_at":"2024-11-13T10:52:01.872Z","updated_at":"2025-05-05T08:32:34.140Z","avatar_url":"https://github.com/code4mk.png","language":"PHP","readme":"\u003cp align=\"center\" \u003e\u003cimg src=\"https://user-images.githubusercontent.com/17185462/57544423-1ad64d80-7379-11e9-8191-3916f389032e.png\"\u003e\u003c/p\u003e\n\n# Rating system Laravel\n\nEasily setup rating system in your laravel poject\n\n# installation\n\n```bash\ncomposer require code4mk/lara-rating\n```\n\n# setup\n\n## 1) vendor publish\n\n```bash\nphp artisan vendor:publish --provider=\"Code4mk\\LaraRate\\LaraRateServiceProvider\" --tag=config\nphp artisan vendor:publish --provider=\"Code4mk\\LaraRate\\LaraRateServiceProvider\" --tag=migrations\n```\n\n## 2) config\n\n* `config/laraRate.php`\n\n\n```php\n\"rater_table_name\" =\u003e \"users\",\n\"rater_retrive_columns\" =\u003e[\"id\",\"email\"]\n```\n\n* `php artisan config:clear`\n\n# method\n\n## `create()`\n\n* `int $productID, int $raterID, int $rate, string $comment`\n\n```php\nuse Krate;\nKrate::create($productID,$userID,$rate,$comment)\n```\n\n## `update()`\n\n* `int $productID, int $raterID, int $rate, string $comment`\n\n```php\nuse Krate;\nKrate::update($productID,$raterID,$rate,$comment);\n```\n\n## `getRatings()`\n\n* get specific product's rating details\n* `int productID`\n```php\nKrate::getRatings($productID);\n```\n* output\n\n~ `Krate::getRatings(3)`\n\n```json\n[\n  {\n    \"id\": 1,\n    \"product_id\": 3,\n    \"rater_id\": 3,\n    \"rating\": 5,\n    \"comment\": \"5star\",\n    \"created_at\": \"2019-05-10 16:25:10\",\n    \"updated_at\": \"2019-05-10 16:25:10\",\n    \"rater\": {\n      \"id\": 3,\n      \"email\": \"maruf@gmail.com\"\n    }\n  },\n  {\n    \"id\": 2,\n    \"product_id\": 3,\n    \"rater_id\": 2,\n    \"rating\": 2,\n    \"comment\": \"2star\",\n    \"created_at\": \"2019-05-10 16:26:58\",\n    \"updated_at\": \"2019-05-10 16:26:58\",\n    \"rater\": {\n      \"id\": 2,\n      \"email\": \"jamal@gmail.com\"\n    }\n  }\n]\n```\n\n\n## `getRatingStat()`\n\n* rating type\n* `int productID`\n```php\nKrate::getRatingStat($productID);\n```\n\n\n* output  \n\n~ `Krate::getRatingStat(3)`\n\n```json\n{\n    \"rateType\": {\n        \"one_star\": {\n            \"star\": 0,\n            \"percent\": 0\n        },\n        \"two_star\": {\n            \"star\": 1,\n            \"percent\": 50\n        },\n        \"three_star\": {\n            \"star\": 0,\n            \"percent\": 0\n        },\n        \"four_star\": {\n            \"star\": 0,\n            \"percent\": 0\n        },\n        \"five_star\": {\n            \"star\": 1,\n            \"percent\": 50\n        }\n    },\n    \"total_rater\": 2,\n    \"rating\": 4\n}\n```\n\n## getRaterRatings\n\n* customer/rater/user's rating lists  \n* `int raterID`\n\n```php\nKrate::getRaterRatings($raterID);\n```\n\n~ `Krate::getRaterRatings(2)`\n\n```json\n[\n    {\n        \"id\": 1,\n        \"product_id\": 1,\n        \"rater_id\": 1,\n        \"rating\": 5,\n        \"comment\": \"5 star\",\n        \"created_at\": \"2019-05-11 00:55:46\",\n        \"updated_at\": \"2019-05-11 00:55:46\",\n        \"product\": {\n            \"name\": \"iphone 10\",\n            \"slug\": \"iphone-10\"\n        }\n    }\n]\n```\n\n\n\n\u003ca href=\"https://twitter.com/0devco\" target=\"_blank\" \u003e\u003cp align=\"center\" \u003e\u003cimg src=\"https://raw.githubusercontent.com/0devco/docs/master/.devco-images/logo-transparent.png\"\u003e\u003c/p\u003e\u003c/a\u003e\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcode4mk%2Flara-rating","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fcode4mk%2Flara-rating","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcode4mk%2Flara-rating/lists"}