Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add create:migration console command documentation #165

Merged
merged 1 commit into from
Nov 1, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions console/introduction.md
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,7 @@ Command | Description
[`create:controller`](../console/scaffolding#create-a-backend-controller) | Create a Controller in a plugin.
[`create:formwidget`](../console/scaffolding#create-a-form-widget) | Create a FormWidget in a plugin.
[`create:job`](../console/scaffolding#create-a-job) | Create a Job class in a plugin.
[`create:migration`](../console/scaffolding#create-a-migration) | Create a Migration in a plugin.
[`create:model`](../console/scaffolding#create-a-model) | Create a Model in a plugin.
[`create:plugin`](../console/scaffolding#create-a-plugin) | Create a Plugin.
[`create:reportwidget`](../console/scaffolding#create-a-report-widget) | Create a ReportWidget in a plugin.
Expand Down
20 changes: 20 additions & 0 deletions console/scaffolding.md
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,26 @@ php artisan create:component <plugin code> <component name>

The `create:component` command creates a new component class and the default component view. The first argument specifies the plugin code of the plugin that this component will be added into, and the second parameter specifies the component class name, eg. `MyComponent`.

## Create a migration

The `create:migration` command generates the migration file needed for a model database. The first argument specifies the plugin code of the plugin that this migration will be added into. Without any options, a bare migration file gets generated.

```bash
php artisan create:migration <plugin code>
```

In order to create a migration that auto-populates columns for your model, use the `--create` and `--model` options:

```bash
php artisan create:migration <plugin code> --create --model YourModel
```

In order to create an "update" migration, use the `--update` and `--model` options:

```bash
php artisan create:migration <plugin code> --update --model YourModel
```

## Create a model

```bash
Expand Down