remove faker from prod

This commit is contained in:
Andras Bacsai 2023-05-02 09:11:22 +02:00
parent 7377f80bdd
commit 4ebae8dcf6
6 changed files with 70 additions and 7 deletions

View File

@ -10,8 +10,7 @@ class EmptyProject extends Component
public function createEmptyProject()
{
$project = Project::create([
'name' => fake()->company(),
'description' => fake()->sentence(),
'name' => generateRandomName(),
'team_id' => session('currentTeam')->id,
]);
return redirect()->route('project.environments', ['project_uuid' => $project->uuid, 'environment_name' => 'production']);

View File

@ -79,8 +79,7 @@ public function submit()
if ($this->type === 'project') {
$project = Project::create([
'name' => fake()->company(),
'description' => fake()->sentence(),
'name' => generateRandomName(),
'team_id' => session('currentTeam')->id,
]);
$environment = $project->environments->first();
@ -89,7 +88,7 @@ public function submit()
$environment = $project->environments->where('name', $this->parameters['environment_name'])->firstOrFail();
}
$application_init = [
'name' => fake()->words(2, true),
'name' => generateRandomName(),
'git_repository' => $git_repository,
'git_branch' => $git_branch,
'build_pack' => 'nixpacks',

View File

@ -43,7 +43,7 @@ public function addPrivateKey()
public function submit()
{
$server = Server::create([
'name' => fake()->company,
'name' => generateRandomName(),
'ip' => $this->ip,
'user' => $this->user,
'port' => $this->port,

View File

@ -143,3 +143,14 @@ function getLatestVersionOfCoolify()
return data_get($versions, 'coolify.v4.version');
}
}
if (!function_exists('generateRandomName')) {
function generateRandomName()
{
$generator = new \Nubs\RandomNameGenerator\All(
[
new \Nubs\RandomNameGenerator\Vgng()
]
);
return $generator->getName();
}
}

View File

@ -13,6 +13,7 @@
"laravel/tinker": "^v2.8.1",
"lcobucci/jwt": "^5.0.0",
"livewire/livewire": "^v2.12.3",
"nubs/random-name-generator": "^2.2",
"spatie/laravel-activitylog": "^4.7.3",
"spatie/laravel-data": "^3.4.3",
"spatie/laravel-ray": "^1.32.4",

55
composer.lock generated
View File

@ -4,7 +4,7 @@
"Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies",
"This file is @generated automatically"
],
"content-hash": "fe67e3799aed430897c4ad82f323abe1",
"content-hash": "edc1042455661505e65373a55fed9b81",
"packages": [
{
"name": "bacon/bacon-qr-code",
@ -2469,6 +2469,59 @@
},
"time": "2023-03-05T19:49:14+00:00"
},
{
"name": "nubs/random-name-generator",
"version": "v2.2.0",
"source": {
"type": "git",
"url": "https://github.com/nubs/random-name-generator.git",
"reference": "50abf24519badc5795a43c831f1d2a1faa45cb77"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/nubs/random-name-generator/zipball/50abf24519badc5795a43c831f1d2a1faa45cb77",
"reference": "50abf24519badc5795a43c831f1d2a1faa45cb77",
"shasum": ""
},
"require": {
"php": "~5.6 || ~7.0 || ~8.0"
},
"require-dev": {
"cinam/randomizer": ">=1.1.1,<2.0",
"php-coveralls/php-coveralls": "~2.4",
"phpunit/phpunit": "^5.0 || ^6.5 || ^7.0 || ^9.0",
"squizlabs/php_codesniffer": "~2.3"
},
"type": "library",
"autoload": {
"psr-4": {
"Nubs\\RandomNameGenerator\\": "src"
}
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"MIT"
],
"authors": [
{
"name": "Spencer Rinehart",
"email": "anubis@overthemonkey.com",
"role": "Developer"
}
],
"description": "A library to create interesting, sometimes entertaining, random names.",
"keywords": [
"alliteration",
"generator",
"random",
"video game"
],
"support": {
"issues": "https://github.com/nubs/random-name-generator/issues",
"source": "https://github.com/nubs/random-name-generator/tree/v2.2.0"
},
"time": "2021-01-12T13:46:08+00:00"
},
{
"name": "nunomaduro/termwind",
"version": "v1.15.1",