{"id":24429496,"url":"https://github.com/bjnstnkvc/laravel-builder-make-command","last_synced_at":"2026-01-05T19:35:54.709Z","repository":{"id":223748310,"uuid":"756066677","full_name":"BJNSTNKVC/laravel-builder-make-command","owner":"BJNSTNKVC","description":"Generate Eloquent Builder class for enhanced query building and model scope management.","archived":false,"fork":false,"pushed_at":"2024-09-24T17:07:43.000Z","size":136,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2024-11-29T13:09:43.647Z","etag":null,"topics":["builder","eloquent","laravel","query","scope"],"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/BJNSTNKVC.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","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":"2024-02-11T21:49:34.000Z","updated_at":"2024-09-24T17:07:18.000Z","dependencies_parsed_at":"2024-07-18T20:10:39.312Z","dependency_job_id":"f697ab6b-77a8-499b-a9e3-f3aae6c7e4a0","html_url":"https://github.com/BJNSTNKVC/laravel-builder-make-command","commit_stats":null,"previous_names":["bjnstnkvc/laravel-builder-make-command"],"tags_count":3,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/BJNSTNKVC%2Flaravel-builder-make-command","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/BJNSTNKVC%2Flaravel-builder-make-command/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/BJNSTNKVC%2Flaravel-builder-make-command/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/BJNSTNKVC%2Flaravel-builder-make-command/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/BJNSTNKVC","download_url":"https://codeload.github.com/BJNSTNKVC/laravel-builder-make-command/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":234797547,"owners_count":18888249,"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":["builder","eloquent","laravel","query","scope"],"created_at":"2025-01-20T13:39:04.742Z","updated_at":"2025-10-01T00:31:30.865Z","avatar_url":"https://github.com/BJNSTNKVC.png","language":"PHP","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Laravel make:builder Command\n\nGenerate Eloquent Builder class for enhanced query building and model scope management.\n\n## Features\n\n- Dynamic query methods for `where`, `whereIn`, `whereLike`, `whereNot`, `whereNotIn`, `whereNotLike`, `orWhere`, `orWhereIn`, `orWhereLike`, `orWhereNot`, `orWhereNotIn` and `orWhereNotLike`.\n- Simplifies the construction of complex queries with readable method chains.\n- Automatically handles method calls that are not natively supported by Laravel Query Builder by transforming them\n  into appropriate query conditions.\n\n## Installation \u0026 setup\n\nYou can install the package via composer:\n\n```bash\ncomposer require bjnstnkvc/builder-make-command\n```\n\nThe package will automatically register its service provider.\n\nIn case you would like to change the package defaults, you can do so by publishing the config:\n\n```bash\nphp artisan vendor:publish --provider=\"Bjnstnkvc\\BuilderMakeCommand\\BuilderMakeCommandServiceProvider\" --tag=make-builder-config\n```\n\nor stubs\n\n```bash\nphp artisan vendor:publish --provider=\"Bjnstnkvc\\BuilderMakeCommand\\BuilderMakeCommandServiceProvider\" --tag=make-builder-stubs\n```\n\n## Usage\n\nOnce the package has been installed, you can run it via CLI the same way you would for any of the other CLI commands.\n\n```bash\nphp artisan make:builder UserBuilder\n```\n\nBy default, the command will try figure out the name of the model from the name of the builder (E.g. `UserBuilder` will\nattempt to look for `User` model).\n\nAdditionally, you can pass a model name as a second argument.\n\n```bash\nphp artisan make:builder UserBuilder User\n```\n\nIn case the Builder already exists, you can pass an optional `--force` argument which will overwrite the existing class.\n\n```bash\nphp artisan make:builder UserBuilder User --force\n```\n\n\u003e **Note**: By forcing the Builder command, all custom methods you've added to the Builder will be overwritten so be\n\u003e cautious.\n\nIf you simply call the command, without any arguments, Laravel will prompt you for input.\n\n```bash\nphp artisan make:builder\n```\n\n```bash\nWhat should the builder be named?\n\u003e UserBuilder\n```\n\n```bash\nWhat is the model name? [User]\n\u003e \n```\n\n```bash\nOverwrite existing file? (yes/no) [no]\n\u003e \n```\n\n\u003e The name of the Model has been derived from the Builder name and set as a default. Confirm by pressing ENTER or enter\n\u003e the name of the Model.\n\u003e\n\u003eIn case the file already exists, you will be prompted whether you would like to overwrite the existing file.\n\nOnce the command has been run, the Builder class will be created inside `app\\Models\\Builders` folder.\n\nIn order to use it inside your models, add `HasDynamicBuilder` trait to your model:\n\n```php\nuse Bjnstnkvc\\BuilderMakeCommand\\Concerns\\HasDynamicBuilder;\n\nclass User extends Model\n{\n    use HasDynamicBuilder;\n}\n```\n\nOnce added, dynamic where clauses for every Model column is added as an Eloquent method.\n\n```php\nUser::whereId(mixed $operator = null, mixed $value = null, string $boolean = 'and');\nUser::whereIdNot(mixed $operator = null, mixed $value = null, string $boolean = 'and');\nUser::whereIdIn(array $values, string $boolean = 'and', bool $not = false);\nUser::whereIdNotIn(array $values, string $boolean = 'and');\nUser::whereIdLike(string $value, bool $caseSensitive = false, string $boolean = 'and', bool $not = false);\nUser::whereIdNotLike(string $value, bool $caseSensitive = false, string $boolean = 'and', bool $not = false);\nUser::orWhereId(mixed $operator = null, mixed $value = null);\nUser::orWhereIdNot(mixed $operator = null, mixed $value = null);\nUser::orWhereIdIn(array $values);\nUser::orWhereIdNotIn(array $values);\nUser::orWhereIdLike(string $value, bool $caseSensitive = false);\nUser::orWhereIdNotLike(string $value, bool $caseSensitive = false);\n\n// Methods for other database columns.\n```\n\nNaturally, these methods can be chained on:\n\n```php\nUser::whereId(1)\n    -\u003eorWhereNameNot('John')\n    -\u003efirst();\n```\n\n```php\nUser::whereId('\u003e', 1)\n    -\u003eorWhereEmail('email@example.com')\n    -\u003efirst();\n```\n\nIn case you need to group several \"where\" clauses within parentheses in order to achieve your query's desired Logical\nGrouping, you can do the following:\n\n```php\nuse App\\Models\\Builders\\UserBuilder;\n\nUser::whereName('John')\n    -\u003ewhere(function (UserBuilder $query) {\n        $query-\u003ewhereEmail('email@example.com')\n              -\u003eorWhereTitle('Admin');\n    })\n    -\u003efirst();\n```\n\nIn case you would like to generate the Builder method signatures as a mixin, you can use the `--mixin` flag:\n\n```bash\nphp artisan make:builder UserBuilder User --mixin\n```\n\nThe mixin will be created inside `.builder.mixin.php` file and automatically imported into the Builder class.","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbjnstnkvc%2Flaravel-builder-make-command","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fbjnstnkvc%2Flaravel-builder-make-command","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbjnstnkvc%2Flaravel-builder-make-command/lists"}