Skip to main content
Version: 1.x

Artisan Command

Artisan Command List

Laravel Firestore Eloquent provides a convenient Artisan command to generate new model quickly. Run the following command to make a new User Model.

php artisan make:fmodel User

This command will generate a new file in your project: app/FModel/User.php.

IMPORTANT NOTES

Note that if you have modified the class_namespace value in the configuration file located at config/firestore.php, you can locate the new file generated using the namespace as the path. See here for more details.

Artisan Command Options

The make:fmodel command has the following options:

OptionDescription
--collection=The collection name to be used for the model.
--primaryKeyThe primary key to be used for the model.

Artisan Command Examples

Generate a new model

php artisan make:fmodel User

Generate a new model with a custom collection name

php artisan make:fmodel User --collection=users

Generate a new model with a custom primary key

php artisan make:fmodel User --primaryKey=uid

Generate a new model with a custom collection name and primary key

php artisan make:fmodel User --collection=users --primaryKey=uid
RESULT

The above command will generate a new file in your project: app/FModel/User.php with primaryKey uid and collection name users.