Skip to content
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
17 changes: 17 additions & 0 deletions boilerplate/stubs/backend/model-factory.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
<?php

namespace <%= classNamespace %>;

use Illuminate\Database\Eloquent\Factories\Factory;

class <%= className %> extends Factory
{
// A default for each column, so tests only need to set the ones they care about.
// See https://docs.flarum.org/2.x/extend/testing#model-factories for more information.
public function definition(): array
{
return [
//
];
}
}
3 changes: 3 additions & 0 deletions boilerplate/stubs/backend/model.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,12 @@
use Flarum\Database\AbstractModel;
use Flarum\Database\ScopeVisibilityTrait;
use Flarum\Foundation\EventGeneratorTrait;
use Illuminate\Database\Eloquent\Factories\HasFactory;

class <%= className %> extends AbstractModel
{
use HasFactory;

// See https://docs.flarum.org/2.x/extend/models.html#backend-models for more information.
<% if (tableName) { %>
protected $table = '<%= tableName %>';<% } %>
Expand Down
12 changes: 12 additions & 0 deletions php-subsystem/index.php
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,18 @@
$output = (new Flarum\CliPhpSubsystem\Upgrade\TwoPointOh\Search())->handle($input['file'], $input['code'] ?? null, $input['data'] ?? []);
break;

case 'upgrade.2-0.migrations-schema':
$output = (new Flarum\CliPhpSubsystem\Upgrade\TwoPointOh\ModelFactories())->schema($input['data']['migrations'] ?? []);
break;

case 'upgrade.2-0.models':
$output = (new Flarum\CliPhpSubsystem\Upgrade\TwoPointOh\ModelFactories())->models($input['data']['files'] ?? []);
break;

case 'upgrade.2-0.model-factory':
$output = (new Flarum\CliPhpSubsystem\Upgrade\TwoPointOh\ModelFactories())->factory($input['file'], $input['code'], $input['data'] ?? []);
break;

case 'upgrade.2-0.phpunit':
$output = (new Flarum\CliPhpSubsystem\Upgrade\TwoPointOh\PhpUnit())->handle($input['file'], $input['code'] ?? null, $input['data'] ?? []);
break;
Expand Down
Loading
Loading