{"id":22889617,"url":"https://github.com/dillingham/morphable","last_synced_at":"2026-05-19T14:31:29.850Z","repository":{"id":56969090,"uuid":"204036959","full_name":"dillingham/morphable","owner":"dillingham","description":"resolve morph models in controllers by type \u0026 id","archived":false,"fork":false,"pushed_at":"2019-08-24T00:53:37.000Z","size":23,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":0,"default_branch":"master","last_synced_at":"2025-02-07T00:28:48.905Z","etag":null,"topics":["laravel"],"latest_commit_sha":null,"homepage":"","language":"PHP","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/dillingham.png","metadata":{"files":{"readme":"readme.md","changelog":null,"contributing":null,"funding":null,"license":"license.md","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2019-08-23T16:49:34.000Z","updated_at":"2019-08-24T06:08:34.000Z","dependencies_parsed_at":"2022-08-21T06:40:17.975Z","dependency_job_id":null,"html_url":"https://github.com/dillingham/morphable","commit_stats":null,"previous_names":[],"tags_count":2,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dillingham%2Fmorphable","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dillingham%2Fmorphable/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dillingham%2Fmorphable/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dillingham%2Fmorphable/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/dillingham","download_url":"https://codeload.github.com/dillingham/morphable/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":246531974,"owners_count":20792736,"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"],"created_at":"2024-12-13T21:56:23.567Z","updated_at":"2025-10-04T04:46:47.073Z","avatar_url":"https://github.com/dillingham.png","language":"PHP","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Morphable\n\n[![Latest Version on Github](https://img.shields.io/github/release/dillingham/morphable.svg?style=flat-square)](https://packagist.org/packages/dillingham/morphable)\n[![Total Downloads](https://img.shields.io/packagist/dt/dillingham/morphable.svg?style=flat-square)](https://packagist.org/packages/dillingham/morphable) [![Twitter Follow](https://img.shields.io/twitter/follow/dillinghammm?color=%231da1f1\u0026label=Twitter\u0026logo=%231da1f1\u0026logoColor=%231da1f1\u0026style=flat-square)](https://twitter.com/dillinghammm)\n\n```\ncomposer require dillingham/morphable\n```\n- Add `Morphable` to a model\n- Add `ResolveMorphs` to your base controller\n- Fill `$morphable` on a controller with model classes\n- Submit `type` and `id` to a controller\n- adds `-\u003eforMorph($model)` to fill object_type, object_id\n```php\n\u003c?php\n\nclass CommentController extends Controller\n{\n    use ResolveMorphs;\n    \n    public $morphable = [\n        \\App\\Post::class\n    ];\n\n    public function store()\n    {\n        $model = $this-\u003eresolveMorph();\n\n        $comment = new Comment;\n        $comment-\u003eforMorph($model);\n        $comment-\u003esave();\n    }\n}\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdillingham%2Fmorphable","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fdillingham%2Fmorphable","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdillingham%2Fmorphable/lists"}