Initial commit

This commit is contained in:
Ronald Huynen
2026-03-23 21:37:59 +01:00
commit 2547717edb
2193 changed files with 972171 additions and 0 deletions

View File

@@ -0,0 +1,25 @@
<?php
namespace Database\Factories;
use Illuminate\Database\Eloquent\Factories\Factory;
class AccountFactory extends Factory
{
/**
* Define the model's default state.
*
* @return array
*/
public function definition()
{
return [
'name' => 'Personal Account',
'limit_min' => 0,
'limit_max' => 12000,
'accountable_type' => 'App\Models\User',
];
}
}

View File

@@ -0,0 +1,41 @@
<?php
namespace Database\Factories;
use App\Models\Admin;
use Illuminate\Database\Eloquent\Factories\Factory;
use Illuminate\Support\Facades\Hash;
use Illuminate\Support\Str;
class AdminFactory extends Factory
{
protected $model = Admin::class;
public function definition()
{
return [
'name' => $this->faker->unique()->userName(),
'full_name' => $this->faker->name(),
'email' => $this->faker->unique()->safeEmail(),
'email_verified_at' => now(),
'password' => Hash::make('password'),
'profile_photo_path' => null,
'about' => $this->faker->paragraph(),
'about_short' => $this->faker->sentence(),
'motivation' => $this->faker->paragraph(),
'website' => $this->faker->optional()->url(),
'phone' => $this->faker->optional()->phoneNumber(),
'phone_public' => $this->faker->boolean(),
'lang_preference' => 'en',
];
}
public function unverified()
{
return $this->state(function (array $attributes) {
return [
'email_verified_at' => null,
];
});
}
}

View File

@@ -0,0 +1,29 @@
<?php
namespace Database\Factories;
use Illuminate\Database\Eloquent\Factories\Factory;
/**
* @extends \Illuminate\Database\Eloquent\Factories\Factory<\App\Models\Bank>
*/
class BankFactory extends Factory
{
/**
* Define the model's default state.
*
* @return array
*/
public function definition()
{
return [
'name' => $this->faker->unique()->company(),
'full_name' => $this->faker->company() . ' ' . $this->faker->companySuffix(),
'email' => $this->faker->unique()->safeEmail(),
'email_verified_at' => now(),
'profile_photo_path' => $this->faker->imageUrl(128, 128),
'about' => $this->faker->text(mt_rand(50, 300)),
'password' => \Illuminate\Support\Facades\Hash::make('password'),
];
}
}

View File

@@ -0,0 +1,55 @@
<?php
namespace Database\Factories;
use Illuminate\Database\Eloquent\Factories\Factory;
use Namu\WireChat\Models\Conversation;
use Namu\WireChat\Enums\ConversationType;
/**
* @extends \Illuminate\Database\Eloquent\Factories\Factory<\Namu\WireChat\Models\Conversation>
*/
class ConversationFactory extends Factory
{
/**
* The name of the factory's corresponding model.
*
* @var string
*/
protected $model = Conversation::class;
/**
* Define the model's default state.
*
* @return array<string, mixed>
*/
public function definition(): array
{
return [
'type' => ConversationType::Private,
'disappearing_started_at' => null,
'disappearing_duration' => null,
];
}
/**
* Indicate that the conversation is a group.
*/
public function group(): static
{
return $this->state(fn (array $attributes) => [
'type' => ConversationType::Group,
]);
}
/**
* Indicate that the conversation has disappearing messages enabled.
*/
public function withDisappearing(int $duration = 86400): static
{
return $this->state(fn (array $attributes) => [
'disappearing_started_at' => now(),
'disappearing_duration' => $duration,
]);
}
}

View File

@@ -0,0 +1,24 @@
<?php
namespace Database\Factories\Locations;
use Illuminate\Database\Eloquent\Factories\Factory;
/**
* @extends \Illuminate\Database\Eloquent\Factories\Factory<\App\Models\Model>
*/
class LocationFactory extends Factory
{
/**
* Define the model's default state.
*
* @return array<string, mixed>
*/
public function definition()
{
return [
// 'name' => 'Default location',
];
}
}

View File

@@ -0,0 +1,25 @@
<?php
namespace Database\Factories;
use Illuminate\Database\Eloquent\Factories\Factory;
class OrganizationFactory extends Factory
{
/**
* Define the model's default state.
*
* @return array
*/
public function definition()
{
return [
'name' => $this->faker->company(),
'email' => $this->faker->safeEmail(),
'email_verified_at' => now(),
'profile_photo_path' => $this->faker->imageUrl(128, 128),
'about' => $this->faker->text(mt_rand(50, 300)),
'motivation' => $this->faker->text(mt_rand(50, 150)),
];
}
}

View File

@@ -0,0 +1,23 @@
<?php
namespace Database\Factories;
use Illuminate\Database\Eloquent\Factories\Factory;
class ProfileFactory extends Factory
{
/**
* Define the model's default state.
*
* @return array
*/
public function definition()
{
return [
'first_name' => $this->faker->firstName(),
'last_name' => $this->faker->lastName(),
'date_of_birth' => $this->faker->dateTimeBetween('-70 year', '-18 year'),
'content' => $this->faker->text(mt_rand(50, 300))
];
}
}

View File

@@ -0,0 +1,18 @@
<?php
namespace Database\Factories;
use App\Models\Tag;
use Illuminate\Database\Eloquent\Factories\Factory;
class TagFactory extends Factory
{
protected $model = Tag::class;
public function definition(): array
{
return [
'name' => $this->faker->unique()->words(2, true),
];
}
}

View File

@@ -0,0 +1,37 @@
<?php
namespace Database\Factories;
use App\Models\Account;
use App\Models\Transaction;
use Illuminate\Database\Eloquent\Factories\Factory;
class TransactionFactory extends Factory
{
/**
* The name of the factory's corresponding model.
*
* @var string
*/
protected $model = Transaction::class;
/**
* Define the model's default state.
*
* @return array
*/
public function definition()
{
//TODO: use all fields
$fromAccountId = Account::all()->random()->id;
$toAccountId = Account::all()->random()->id;
return [
'from_account_id' => $fromAccountId,
'to_account_id' => $toAccountId,
// 'creator_user_id' => Account::find($fromAccountId)->accountable->id,
'creator_user_id' => 1,
'amount' => $this->faker->numberBetween(15, 2000),
'description' => $this->faker->sentence(),
];
}
}

View File

@@ -0,0 +1,74 @@
<?php
namespace Database\Factories;
use App\Models\Team;
use App\Models\User;
use Illuminate\Database\Eloquent\Factories\Factory;
use Illuminate\Support\Str;
use Laravel\Jetstream\Features;
class UserFactory extends Factory
{
/**
* The name of the factory's corresponding model.
*
* @var string
*/
protected $model = User::class;
/**
* Define the model's default state.
*
* @return array
*/
public function definition()
{
return [
'name' => $this->faker->userName(),
'full_name' => $this->faker->name(),
'email' => $this->faker->unique()->safeEmail(),
'email_verified_at' => now(),
'password' => bcrypt('password'), // Default password
'remember_token' => Str::random(10),
'profile_photo_path' => 'app-images/profile-user-new.svg',
'about' => $this->faker->text(mt_rand(50, 300)),
'motivation' => $this->faker->text(mt_rand(50, 150)),
'lang_preference' => 'en', // Default to null, can be set later
];
}
/**
* Indicate that the model's email address should be unverified.
*
* @return \Illuminate\Database\Eloquent\Factories\Factory
*/
public function unverified()
{
return $this->state(function (array $attributes) {
return [
'email_verified_at' => null,
];
});
}
/**
* Indicate that the user should have a personal team.
*
* @return $this
*/
public function withPersonalTeam()
{
if (! Features::hasTeamFeatures()) {
return $this->state([]);
}
return $this->has(
Team::factory()
->state(function (array $attributes, User $user) {
return ['name' => $user->name.'\'s Team', 'user_id' => $user->id, 'personal_team' => true];
}),
'ownedTeams'
);
}
}