Download the PHP package amestsantim/laravel-seeder-with-data-generator without Composer
On this page you can find all versions of the php package amestsantim/laravel-seeder-with-data-generator. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download amestsantim/laravel-seeder-with-data-generator
More information about amestsantim/laravel-seeder-with-data-generator
Files in amestsantim/laravel-seeder-with-data-generator
Package laravel-seeder-with-data-generator
Short Description Generate laravel seeders with data
License MIT
Informations about the package laravel-seeder-with-data-generator
Laravel Seeder (with data) Generator
This is a laravel package which adds a generator command (make) to your artisan commands that will generate a database seeder class for you. It is similar to the included seeder class generator except that this generator allows you to pass data to it to include in the seeder class.
This can come in handy in situations where you might have database entries you want to be included with your deployment (such as roles and permissions, etc.)
make:seeder-with-data
Install
Usage
Arguments: tableName The name of the DB table data The data, as a serialized array of named index arrays [default: "[]"] Options: --path[=PATH] Path where the seeder file should be saved --timestamps If present, this switch will enable the automatic insertion of timestamps
Examples
Notice the format that we use, the data argument is passed in as is. Remember to put it in double quotation marks.
...this will give you:
You can also specify where the generated seeder is saved by using the --path option like so,
It will create the directories in the path if they do not already exist.
If you omit the data argument, the default, which is an empty array will be used so that the seeder will still run without any errors but will effectively do nothing.
Specifying the --timeStamps switch will change the value of the $timestamps property on the model to true. This will enable the automatic addition of the created_at and updated_at fields in the inserted data. The command would like like this: