Skip to content
43 changes: 0 additions & 43 deletions database/seeders/BackstageSeeder.php
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@
use Backstage\Models\Language;
use Backstage\Models\Site;
use Backstage\Models\Type;
use Backstage\Models\User;
use Illuminate\Database\Seeder;
use Illuminate\Support\Str;

Expand Down Expand Up @@ -173,47 +172,5 @@ public function run(): void
(string) Str::uuid() => ['type' => 'form', 'data' => ['slug' => 'contact']],
]),
]), 'values')->create();

User::factory([
'name' => 'Mark',
'email' => 'mark@vk10.nl',
'password' => 'mark@vk10.nl',
])->create();

User::factory([
'name' => 'Rob',
'email' => 'rob@vk10.nl',
'password' => 'rob@vk10.nl',
])->create();

User::factory([
'name' => 'Mathieu',
'email' => 'mathieu@vk10.nl',
'password' => 'mathieu@vk10.nl',
])->create();

User::factory([
'name' => 'Bas',
'email' => 'bas@vk10.nl',
'password' => 'bas@vk10.nl',
])->create();

User::factory([
'name' => 'Yoni',
'email' => 'yoni@vk10.nl',
'password' => 'yoni@vk10.nl',
])->create();

User::factory([
'name' => 'Patrick',
'email' => 'patrick@vk10.nl',
'password' => 'patrick@vk10.nl',
])->create();

User::factory([
'name' => 'Sandro',
'email' => 'sandro@vk10.nl',
'password' => 'sandro@vk10.nl',
])->create();
}
}
2 changes: 1 addition & 1 deletion packages/core/config/backstage/cms.php
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
Backstage\Resources\SettingResource::class,
Backstage\Resources\SiteResource::class,
Backstage\Resources\TagResource::class,
Backstage\Resources\MediaResource::class,
// Backstage\Resources\MediaResource::class,
// Backstage\Resources\TemplateResource::class,
Backstage\Resources\TypeResource::class,
Backstage\Resources\UserResource::class,
Expand Down
43 changes: 0 additions & 43 deletions packages/core/database/seeders/BackstageSeeder.php
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@
use Backstage\Models\Language;
use Backstage\Models\Site;
use Backstage\Models\Type;
use Backstage\Models\User;
use Illuminate\Database\Seeder;
use Illuminate\Support\Str;

Expand Down Expand Up @@ -173,47 +172,5 @@ public function run(): void
(string) Str::uuid() => ['type' => 'form', 'data' => ['slug' => 'contact']],
]),
]), 'values')->create();

User::factory([
'name' => 'Mark',
'email' => 'mark@vk10.nl',
'password' => 'mark@vk10.nl',
])->create();

User::factory([
'name' => 'Rob',
'email' => 'rob@vk10.nl',
'password' => 'rob@vk10.nl',
])->create();

User::factory([
'name' => 'Mathieu',
'email' => 'mathieu@vk10.nl',
'password' => 'mathieu@vk10.nl',
])->create();

User::factory([
'name' => 'Bas',
'email' => 'bas@vk10.nl',
'password' => 'bas@vk10.nl',
])->create();

User::factory([
'name' => 'Yoni',
'email' => 'yoni@vk10.nl',
'password' => 'yoni@vk10.nl',
])->create();

User::factory([
'name' => 'Patrick',
'email' => 'patrick@vk10.nl',
'password' => 'patrick@vk10.nl',
])->create();

User::factory([
'name' => 'Sandro',
'email' => 'sandro@vk10.nl',
'password' => 'sandro@vk10.nl',
])->create();
}
}
113 changes: 18 additions & 95 deletions packages/core/src/BackstageServiceProvider.php
Original file line number Diff line number Diff line change
Expand Up @@ -66,18 +66,12 @@ public function configurePackage(Package $package): void
->startWith(function (InstallCommand $command) {
$command->info('Welcome to the Backstage setup process.');
$command->comment("Don't trip over the wires; this is where the magic happens.");
$command->comment('Let\'s get started!');
$command->comment("Let's get started!");

// if ($command->confirm('Would you like us to install Backstage for you?', true)) {
$command->comment('Lights, camera, action! Setting up for the show...');

$command->comment('Preparing stage...');

$command->callSilently('vendor:publish', [
'--tag' => 'translations-config',
'--force' => true,
]);

$command->callSilently('vendor:publish', [
'--tag' => 'backstage-config',
'--force' => true,
Expand All @@ -87,8 +81,6 @@ public function configurePackage(Package $package): void

$this->writeMediaPickerConfig();

$this->writeTranslationsConfig();

$command->callSilently('vendor:publish', [
'--tag' => 'backstage-migrations',
'--force' => true,
Expand Down Expand Up @@ -120,12 +112,27 @@ public function configurePackage(Package $package): void
$path = app()->environmentFilePath();
file_put_contents($path, file_get_contents($path) . PHP_EOL . $key . '=' . $value);

if ($command->confirm('Would you like to create a user?', true)) {
$command->comment('Our next performer is...');
$user = $command->ask('Your name?');
$email = $command->ask('Your email?');
$password = $command->secret('Your password?');
if ($email && $password) {
User::factory()->create([
'name' => $user,
'email' => $email,
'password' => $password,
]);
} else {
$command->error('Stage frights! User not created.');
}
}

$command->comment('Raise the curtain...');
// }
})
->endWith(function (InstallCommand $command) {
$command->info('The stage is cleared for a fresh start');
$command->comment('You can now go on stage and start creating!');
$command->comment('You can now go on stage (/backstage) and start creating!');
})
->askToStarRepoOnGitHub('backstage/cms');
});
Expand Down Expand Up @@ -408,90 +415,6 @@ private function writeMediaPickerConfig(?string $path = null): void
file_put_contents($path, $configContent);
}

private function generateTranslationsConfig(): array
{
$config = [
'scan' => [
'paths' => [
app_path(),
resource_path('views'),
base_path(''),
],

'extensions' => [
'*.php',
'*.blade.php',
'*.json',
],

'functions' => [
'trans',
'trans_choice',
'Lang::transChoice',
'Lang::trans',
'Lang::get',
'Lang::choice',
'@lang',
'@choice',
'__',
],
],

'eloquent' => [
'translatable-models' => [
\Backstage\Models\ContentFieldValue::class,
\Backstage\Models\Tag::class,
],
],

'translators' => [
'default' => env('TRANSLATION_DRIVER', 'google-translate'),

'drivers' => [
'google-translate' => [
// no options
],

'ai' => [
'provider' => \Prism\Prism\Enums\Provider::OpenAI,
'model' => 'gpt-5',
'system_prompt' => 'You are an expert mathematician who explains concepts simply. The only thing you do it output what i ask. No comments, no extra information. Just the answer.',
],

'deep-l' => [
//
],
],
],
];

config(['translations' => $config]);

return $config;
}

private function writeTranslationsConfig(?string $path = null): void
{
$path ??= config_path('translations.php');

// Ensure directory exists
$directory = dirname($path);
if (! is_dir($directory)) {
mkdir($directory, 0755, true);
}

// Generate the config file content
$configContent = "<?php\n\n";
$configContent .= "use Backstage\Models\Tag;\n";
$configContent .= "use Prism\Prism\Enums\Provider;\n";
$configContent .= "use Backstage\Models\ContentFieldValue;\n\n";

// Custom export function to create more readable output
$configContent .= 'return ' . $this->customVarExport($this->generateTranslationsConfig()) . ";\n";

file_put_contents($path, $configContent);
}

private function customVarExport($var, $indent = ''): string
{
switch (gettype($var)) {
Expand Down
21 changes: 21 additions & 0 deletions packages/laravel-redirects/database/factories/RedirectFactory.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
<?php

namespace Backstage\Database\Factories;

use Backstage\Models\Redirect;
use Illuminate\Database\Eloquent\Factories\Factory;

class RedirectFactory extends Factory
{
protected $model = Redirect::class;

public function definition()
{
return [
'source' => $this->faker->url(),
'destination' => $this->faker->url(),
'code' => $this->faker->numberBetween(301, 302),
'hits' => $this->faker->numberBetween(0, 1000),
];
}
}