Download the PHP package bjnstnkvc/builder-make-command without Composer
On this page you can find all versions of the php package bjnstnkvc/builder-make-command. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Informations about the package builder-make-command
Laravel make:builder Command
Generate Eloquent Builder class for enhanced query building and model scope management.
Features
- Dynamic query methods for
where
,whereIn
,whereLike
,whereNot
,whereNotIn
,whereNotLike
,orWhere
,orWhereIn
,orWhereLike
,orWhereNot
,orWhereNotIn
andorWhereNotLike
. - Simplifies the construction of complex queries with readable method chains.
- Automatically handles method calls that are not natively supported by Laravel Query Builder by transforming them into appropriate query conditions.
Installation & setup
You can install the package via composer:
The package will automatically register its service provider.
In case you would like to change the package defaults, you can do so by publishing the config:
or stubs
Usage
Once the package has been installed, you can run it via CLI the same way you would for any of the other CLI commands.
By default, the command will try figure out the name of the model from the name of the builder (E.g. UserBuilder
will
attempt to look for User
model).
Additionally, you can pass a model name as a second argument.
In case the Builder already exists, you can pass an optional --force
argument which will overwrite the existing class.
Note: By forcing the Builder command, all custom methods you've added to the Builder will be overwritten so be cautious.
If you simply call the command, without any arguments, Laravel will prompt you for input.
The name of the Model has been derived from the Builder name and set as a default. Confirm by pressing ENTER or enter the name of the Model.
In case the file already exists, you will be prompted whether you would like to overwrite the existing file.
Once the command has been run, the Builder class will be created inside app\Models\Builders
folder.
In order to use it inside your models, add HasDynamicBuilder
trait to your model:
Once added, dynamic where clauses for every Model column is added as an Eloquent method.
Naturally, these methods can be chained on:
In case you need to group several "where" clauses within parentheses in order to achieve your query's desired Logical Grouping, you can do the following:
In case you would like to generate the Builder method signatures as a mixin, you can use the --mixin
flag:
The mixin will be created inside .builder.mixin.php
file and automatically imported into the Builder class.
All versions of builder-make-command with dependencies
illuminate/support Version ^7.0|^8.0|^9.0|^10.0|^11.0|^12.0
illuminate/database Version ^7.0|^8.0|^9.0|^10.0|^11.0|^12.0