{"id":21110173,"url":"https://github.com/algrvvv/twgrestapi","last_synced_at":"2026-04-09T08:53:31.929Z","repository":{"id":198411999,"uuid":"700479140","full_name":"algrvvv/twgRestApi","owner":"algrvvv","description":"RestApi на laravel основанный на мини соцсети","archived":false,"fork":false,"pushed_at":"2023-10-05T08:48:28.000Z","size":98,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-01-21T04:12:58.051Z","etag":null,"topics":["laravel","mysql","php","rest-api"],"latest_commit_sha":null,"homepage":"","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/algrvvv.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,"governance":null}},"created_at":"2023-10-04T17:10:27.000Z","updated_at":"2023-12-30T11:31:57.000Z","dependencies_parsed_at":null,"dependency_job_id":"10b90ca2-66d0-479c-bcee-227b96d6192d","html_url":"https://github.com/algrvvv/twgRestApi","commit_stats":null,"previous_names":["algrvvv/twgrestapi"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/algrvvv%2FtwgRestApi","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/algrvvv%2FtwgRestApi/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/algrvvv%2FtwgRestApi/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/algrvvv%2FtwgRestApi/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/algrvvv","download_url":"https://codeload.github.com/algrvvv/twgRestApi/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":243558467,"owners_count":20310571,"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":["laravel","mysql","php","rest-api"],"created_at":"2024-11-20T00:58:28.581Z","updated_at":"2025-12-29T08:06:21.644Z","avatar_url":"https://github.com/algrvvv.png","language":"PHP","funding_links":[],"categories":[],"sub_categories":[],"readme":"# TailwindGram Laravel Rest API\n\na written rest api based on my other Tailwindgram project.\n\n\u003e the project uses sanctum api tokens\n\n## Installation\n\nFirst clone this repository, install the dependencies, and setup your .env file.\n\n```\ngit clone git@github.com:algrvvv/twgRestApi.git blog\ncomposer install\ncp .env.example .env\n```\n\nThen create the necessary database. \u003cbr\u003e\nAnd run the initial migrations and seeders.\n\n```\nphp artisan migrate --seed\n```\n\n## register and login to your account\n\n`POST` request: `http://sitename/api/login?email=admin@example.com\u0026password=password`\u003cbr\u003e\nresponse:\n\n```json\n{\n    \"message\": \"Welcome back, admin!\",\n    \"token\": \"generated api-token\"\n}\n```\n`POST` request: `http://sitename/api/register?email=example@example.com\u0026password=password\u0026username=example`\u003cbr\u003e\nresponse:\n\n```json\n{\n    \"message\": \"User created successfully\",\n    \"token\": \"generated api-token\"\n}\n```\n\n\u003ewhen generating tokens, the role of the user is taken into account and, in accordance with it, a token is issued that is endowed with one or another persmission\n\nafter logging in to your account, [approve any post](#admin-approval-of-the-post)\n\n\nbriefly on its functionality:\n\n## Getting all approved posts\nthat is, to see the post you need approval from the admin. \n\n`GET` request: `http://sitename/api/posts/`\u003cbr\u003e\nresponse:\n```json\n{\n    \"data\": [\n        {\n            \"id\": 1,\n            \"title\": \"Pariatur non quibusdam qui.\",\n            \"content\": \"Doloremque aut consequatur saepe pariatur culpa. Sit magni sunt tenetur consequatur id a. Ea qui autem fugiat qui ad est similique.\",\n            \"views\": \"0\",\n            \"author\": \"amber.klein\",\n            \"created_at\": \"2023-10-04T15:33:17.000000Z\"\n        },\n\n        { \"other\" : \"posts\" }\n    ]\n}\n```\n\n## Getting a certain post\n\n`GET` request: `http://sitename/api/posts/1`\u003cbr\u003e\nresponse:\n\n```json\n{\n    \"data\": {\n        \"id\": 1,\n        \"title\": \"Pariatur non quibusdam qui.\",\n        \"content\": \"Doloremque aut consequatur saepe pariatur culpa. Sit magni sunt tenetur consequatur id a. Ea qui autem fugiat qui ad est similique.\",\n        \"views\": \"0\",\n        \"author\": \"amber.klein\",\n        \"created_at\": \"2023-10-04T15:33:17.000000Z\"\n    }\n}\n```\n\n## Getting all comments on a post\n\n`GET` request: `http://sitename/api/posts/1?comments=true`\u003cbr\u003e\nresponse:\n```json\n{\n    \"data\": {\n        \"id\": 1,\n        \"title\": \"Pariatur non quibusdam qui.\",\n        \"content\": \"Doloremque aut consequatur saepe pariatur culpa. Sit magni sunt tenetur consequatur id a. Ea qui autem fugiat qui ad est similique.\",\n        \"views\": \"0\",\n        \"author\": \"amber.klein\",\n        \"created_at\": \"2023-10-04T15:33:17.000000Z\",\n        \"comments\": [\n            {\n                \"id\": 1,\n                \"post_id\": 1,\n                \"author\": \"dbraun\",\n                \"title\": \"ullam et similique iusto ducimus aut\",\n                \"content\": \"Tenetur id quam nulla ad deleniti a voluptas. Quia temporibus earum tenetur dolorem corrupti dolor et. Explicabo omnis commodi quia veniam dolorem placeat et. Nam vitae fuga non expedita dolor eaque in. Cumque libero velit qui in incidunt.\",\n                \"created_at\": \"2023-10-04T15:33:18.000000Z\"\n            }\n        ]\n    }\n}\n```\n\n\u003ethe display of comments can be used during the output of all posts, simply using the same query\n\n## Admin approval of the post\n\n\u003eto do this, you need to have a token that has the necessary permissions and send a PATH request with the header `access = 1`\n\n`PATH` request: `http://sitename/api/posts/6?access=1` \u003cbr\u003e\n\nin case of success, response:\n```json\n{\n    \"message\": \"post has been publishing\"\n}\n```\notherwise:\n\n```json\n{\n    \"message\": \"Invalid ability provided.\",\n}\n```\n\n\u003eafter that, the post will be visible on request `http://sitename/api/posts/`\n\n## Adding comments\n\n`POST` request: `http://sitename/api/posts/2/comment?title=title\u0026content=content` \u003cbr\u003e\nresponse:\n\n```json\n{\n    \"data\": {\n        \"id\": 25,\n        \"post_id\": \"2\",\n        \"author\": \"username\",\n        \"title\": \"title\",\n        \"content\": \"content\",\n        \"created_at\": \"2023-10-05T07:47:35.000000Z\"\n    }\n}\n```\n\n\u003eit is important to have a token that has the authority to create comments\n\n## Deleting posts\n\n`DELETE`request: `http://sitename/api/posts/3` \u003cbr\u003e\nin case of success, response:\n\n```json\n{\n    \"message\": \"post has been deleted\"\n}\n```\n\notherwise:\n\n```json\n{\n    \"message\": \"you dont have a permisson\"\n}\n```","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Falgrvvv%2Ftwgrestapi","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Falgrvvv%2Ftwgrestapi","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Falgrvvv%2Ftwgrestapi/lists"}