{"id":18828501,"url":"https://github.com/muzammal01/syncmodelfillable","last_synced_at":"2025-09-04T00:40:49.975Z","repository":{"id":283705626,"uuid":"884815658","full_name":"Muzammal01/syncmodelfillable","owner":"Muzammal01","description":"A Laravel package that automatically syncs a model's $fillable fields with its corresponding database migration columns by uisng simple Artisan command.","archived":false,"fork":false,"pushed_at":"2025-06-16T17:22:51.000Z","size":71,"stargazers_count":10,"open_issues_count":0,"forks_count":1,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-08-25T01:56:19.309Z","etag":null,"topics":["artisan","database","fillable","laravel","laravel-10","laravel-11","laravel-8","laravel-9","laravel-development","laravel-package","migration","model","package","php","sync"],"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/Muzammal01.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,"zenodo":null}},"created_at":"2024-11-07T12:47:23.000Z","updated_at":"2025-04-21T18:01:44.000Z","dependencies_parsed_at":"2025-04-17T09:57:58.119Z","dependency_job_id":"01abb246-b48b-4cba-85c2-ab1e1b91d7ac","html_url":"https://github.com/Muzammal01/syncmodelfillable","commit_stats":null,"previous_names":["muzammal01/syncmodelfillable"],"tags_count":5,"template":false,"template_full_name":null,"purl":"pkg:github/Muzammal01/syncmodelfillable","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Muzammal01%2Fsyncmodelfillable","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Muzammal01%2Fsyncmodelfillable/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Muzammal01%2Fsyncmodelfillable/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Muzammal01%2Fsyncmodelfillable/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/Muzammal01","download_url":"https://codeload.github.com/Muzammal01/syncmodelfillable/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Muzammal01%2Fsyncmodelfillable/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":273534248,"owners_count":25122636,"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","status":"online","status_checked_at":"2025-09-03T02:00:09.631Z","response_time":76,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"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":["artisan","database","fillable","laravel","laravel-10","laravel-11","laravel-8","laravel-9","laravel-development","laravel-package","migration","model","package","php","sync"],"created_at":"2024-11-08T01:30:02.748Z","updated_at":"2025-09-04T00:40:49.946Z","avatar_url":"https://github.com/Muzammal01.png","language":"PHP","funding_links":[],"categories":[],"sub_categories":[],"readme":"# SyncModelFillable\n\n[![Latest Version on Packagist](https://img.shields.io/packagist/v/muzammal/syncmodelfillable.svg?style=flat-square)](https://packagist.org/packages/muzammal/syncmodelfillable)\n[![Total Downloads](https://img.shields.io/packagist/dt/muzammal/syncmodelfillable.svg?style=flat-square)](https://packagist.org/packages/muzammal/syncmodelfillable)\n\n**SyncModelFillable** is a Laravel package designed to help automatically add or update a model's `$fillable` fields with its database migration columns. 🎉 With just a simple Artisan command.\n\n\n## ✨ Features  \n\n- 🛠️ Syncs model `$fillable` properties with migration columns.  \n- 📦 Supports Laravel versions 8, 9, 10, 11, and 12.  \n- ⚙️ Customizable to exclude specific columns, like timestamps.  \n- 🔄 **New:**  \n  - The `all` flag now **recursively scans all subdirectories** inside `app/Models/`.  \n  - The `--path=` option allows selecting a **custom directory** for scanning models.  \n  - The `--ignore` flag lets you exclude specific models during sync.\n  - 🧹 **Cross-platform Pint support:** Automatically formats the model file after updating the `$fillable` fields, ensuring proper code formatting on all operating systems (Windows, macOS, Linux).\n\n---\n\n## 🚀 Installation  \n\n1. **Install the package via Composer:**  \n\n   ```bash\n   composer require muzammal/syncmodelfillable\n   ```  \n\n2. **(Optional) Publish the configuration file:**  \n\n   ```bash\n   php artisan vendor:publish --tag=syncmodelfillable-config\n   ```  \n\n   This will create a `config/syncfillable.php` file where you can specify columns to exclude (such as `created_at`, `updated_at`, `deleted_at`, etc.).  \n\n---\n\n## 📘 Usage  \n\nThis package provides an Artisan command `sync:fillable` to sync a model's `$fillable` fields with its database migration columns.  \n\n### 🔹 Sync a Specific Model  \n\nTo sync the `$fillable` fields of a specific model inside `app/Models/`, including nested folders run this:  \n\n```bash\nphp artisan sync:fillable Post\n```\n\n### 🔹 Sync All Models (Including Nested Folders)  \n\nTo sync all models inside `app/Models/`, including nested folders:  \n\n```bash\nphp artisan sync:fillable all\n```\n\nThis will:  \n- Scan **all subdirectories** inside `app/Models/` (e.g., `app/Models/Fintech/AnotherFolder/AnotherFolder`).  \n- Match each model with its migration file.  \n- generate the `$fillable` properties accordingly.  \n\n### 🔹 **New:** Custom Path for Models  \n\nYou can specify a custom path instead of using `app/Models/` by using the `--path=` option.  \n\n```bash\nphp artisan sync:fillable --path=app/CustomModels\n```\n\nThis will:  \n- Scan **app/CustomModels/** instead of `app/Models/`.  \n- Sync all models found in that directory.  \n\n### 🔹 **New:** Exclude Models with the `--ignore` Flag  \n\nTo exclude specific models from the sync operation:  \n\n```bash\nphp artisan sync:fillable all --ignore=User\n```\n\nYou can also pass multiple models:  \n\n```bash\nphp artisan sync:fillable all --ignore=User,Product,Order\n```\n\nIf syncing a single model, the `--ignore` flag is not applicable:  \n\n```bash\nphp artisan sync:fillable Product\n```\n\n---\n\n## ⚙️ Configuration  \n\nThe configuration file `syncfillable.php` allows you to exclude certain columns from `$fillable`. By default, common timestamp columns (`created_at`, `updated_at`, `deleted_at`) are excluded.  \n\n**Example configuration:**  \n\n```php\nreturn [\n    'excluded_columns' =\u003e ['created_at', 'updated_at', 'deleted_at'],\n];\n```\n\n---\n\n## 🧹 **Cross-Platform Support for Pint**  \n\nAfter updating the `$fillable` fields, the model file will be automatically formatted using [Pint](https://github.com/laravel/pint). This ensures that your code is properly formatted on all operating systems, including Windows, macOS, and Linux. \n\n- On **Windows**, Pint is run via `vendor\\\\bin\\\\pint.bat`.  \n- On **macOS/Linux**, Pint is executed with `./vendor/bin/pint`.\n\nThis ensures your code maintains consistency and adheres to best practices without requiring manual formatting. ✨\n\n---\n\n## 🔍 Example  \n\nIf your `Post` model has a migration defining `name`, `slug`, and `content` columns, running:  \n\n```bash\nphp artisan sync:fillable Post\n```\n\nWould automatically generate `$fillable` in `Post.php`\n\n```php\nprotected $fillable = ['name', 'slug', 'content'];\n```\nAdditionally, after updating the `$fillable` fields, the `Post.php` file will be formatted to ensure clean code.\n\n---\n\n## 📜 License  \n\nThis package is open-source software licensed under the MIT license.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmuzammal01%2Fsyncmodelfillable","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmuzammal01%2Fsyncmodelfillable","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmuzammal01%2Fsyncmodelfillable/lists"}