{"id":21753601,"url":"https://github.com/melardev/laravelapiblog","last_synced_at":"2026-04-10T21:11:04.676Z","repository":{"id":107256361,"uuid":"171516836","full_name":"melardev/LaravelApiBlog","owner":"melardev","description":null,"archived":false,"fork":false,"pushed_at":"2019-02-19T17:18:03.000Z","size":241,"stargazers_count":2,"open_issues_count":0,"forks_count":1,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-01-25T23:36:16.647Z","etag":null,"topics":["api","blog","cms","ecommerce","eloquent","jwt","laravel","orm","php","rest","web"],"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/melardev.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,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2019-02-19T17:17:56.000Z","updated_at":"2022-11-16T05:53:01.000Z","dependencies_parsed_at":null,"dependency_job_id":"d9adc48e-c08e-4a4c-bcd1-172aea9c3e20","html_url":"https://github.com/melardev/LaravelApiBlog","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/melardev%2FLaravelApiBlog","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/melardev%2FLaravelApiBlog/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/melardev%2FLaravelApiBlog/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/melardev%2FLaravelApiBlog/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/melardev","download_url":"https://codeload.github.com/melardev/LaravelApiBlog/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":244728199,"owners_count":20500023,"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":["api","blog","cms","ecommerce","eloquent","jwt","laravel","orm","php","rest","web"],"created_at":"2024-11-26T09:09:58.823Z","updated_at":"2026-04-10T21:10:59.636Z","avatar_url":"https://github.com/melardev.png","language":"PHP","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Introduction\nThis is an incomplete Laravel Api Blog application\n\n# Features implemented\n- Seeding all models with faker\n- Many models already written: Article, Comment, Like, UserSubscription(following/follower paradigm), Tag, Category, User and Role.\n- Many associations are implemented.\n- Controllers have already some code, they have to be heavily refactored though.\n\n# Useful commands\n\n`composer require fzaninotto/faker`\n`composer install`\n`php artisan make:migration create_articles_table --create=articles`\n`php artisan migrate:rollback`\n`php artisan migrate`\n`php artisan make:migration SiteSubscription --migrate`\n`php artisan make:policy ArticlePolicy --model=Article`\n`php artisan make:policy CommentPolicy --model=Comment`\n`composer dump-auto`\n`php artisan db:seed`\n# Play with the models\n`php artisan tinker`\n```php\nuse App\\Models\\Article;\nArticle::count()\n$article = Article::inRandomOrder()-\u003efirst();\n$article-\u003ecomments();\n$article-\u003elikes();\n$article-\u003euser\n$article-\u003euser-\u003earticles-\u003ecount()\n$article-\u003euser-\u003ecomments-\u003ecount()\n$article-\u003euser-\u003elikes-\u003ecount()\n$article-\u003euser-\u003elikes-\u003efirst\n$article-\u003euser-\u003elikes-\u003efirst()-\u003elikeable_type\n$article-\u003euser-\u003elikes-\u003efirst()-\u003elikeable_id\nuse App\\Models\\User;\n$user = User::first();\n$user-\u003efollowers-\u003ecount()\n$user-\u003efollowing-\u003ecount()\n$user-\u003efollowing-\u003efirst()\n$user-\u003efollowing-\u003efirst()-\u003eid\n$user-\u003eroles\n$user-\u003eisAdmin()\n$user-\u003eisAuthor()\nuse App\\Models\\Like;\n// Find likes assigned to articles\nLike::where('likeable_type', 'like', '%article%')-\u003ecount()\n// Comments related to articles\nComment::where('commentable_type', 'like', '%article%')-\u003ecount()\n// Comments related to comments\nComment::where('commentable_type', 'like', '%comment%')-\u003ecount()\n// Get a comment related to article, assert the type of comentable is Article\nis_a(Comment::where('commentable_type', 'like', '%article%')-\u003efirst()-\u003ecommentable, Article::class)\n=\u003e true\n// Get a comment related to article, assert the type of comentable is Comment\nis_a(Comment::where('commentable_type', 'like', '%comment%')-\u003efirst()-\u003ecommentable, Comment::class)\n=\u003e true\nuse App\\Models\\Tag;\n$tag = Tag::first();\n$tag-\u003earticles-\u003ecount();\n$tag-\u003earticles-\u003efirst()-\u003etags-\u003econtains($tag)\n$tag-\u003ename;\n// How many articles are not associated with $tag\nArticle::whereHas('tags', function($query)use($tag){return $query-\u003ewhere('tags.name', '!=', $tag-\u003ename);})-\u003ecount()\n// TODO: Below is not working fine\nArticle::whereHas('tags', function($query)use($tag){return $query-\u003ewhere('tags.name', '!=', $tag-\u003ename);})-\u003efirst()-\u003etags-\u003econtains($tag)\n```\n\n# Todo\n- Handle my own error tymon messages\n- Improve response on Auth::login()\n- Improve ArticleController:store, I am saving the article then updating it with tags and categories, do everything in one shot\n- Fix taggables and categorizables tables, the created_at and updated_at\nare not set.\n- File upload\n- Using Request OOP\n- Implement the getRandomNotFollowedBy etc helper methods in userRelation Model\n- Password confirmation\n- Refactor user relations to sitesubcription and userSubscription\n- Better exception handling, Custom 404\n- getByAuthor\n\n# Resources\ntodo ...\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmelardev%2Flaravelapiblog","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmelardev%2Flaravelapiblog","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmelardev%2Flaravelapiblog/lists"}