first commit
This commit is contained in:
commit
fec7cb655b
88 files changed
+11607
No files matched your search
@@ -0,0 +1 @@
|
||||
*.sqlite*
|
||||
@@ -0,0 +1,40 @@
|
||||
<?php
|
||||
|
||||
namespace Database\Factories;
|
||||
|
||||
use Illuminate\Database\Eloquent\Factories\Factory;
|
||||
use Illuminate\Support\Str;
|
||||
|
||||
/**
|
||||
* @extends \Illuminate\Database\Eloquent\Factories\Factory<\App\Models\User>
|
||||
*/
|
||||
class UserFactory extends Factory
|
||||
{
|
||||
/**
|
||||
* Define the model's default state.
|
||||
*
|
||||
* @return array<string, mixed>
|
||||
*/
|
||||
public function definition()
|
||||
{
|
||||
return [
|
||||
'name' => fake()->name(),
|
||||
'email' => fake()->unique()->safeEmail(),
|
||||
'email_verified_at' => now(),
|
||||
'password' => '$2y$10$92IXUNpkjO0rOQ5byMi.Ye4oKoEa3Ro9llC/.og/at2.uheWG/igi', // password
|
||||
'remember_token' => Str::random(10),
|
||||
];
|
||||
}
|
||||
|
||||
/**
|
||||
* Indicate that the model's email address should be unverified.
|
||||
*
|
||||
* @return static
|
||||
*/
|
||||
public function unverified()
|
||||
{
|
||||
return $this->state(fn (array $attributes) => [
|
||||
'email_verified_at' => null,
|
||||
]);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,36 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
return new class extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function up()
|
||||
{
|
||||
Schema::create('users', function (Blueprint $table) {
|
||||
$table->id();
|
||||
$table->string('name');
|
||||
$table->string('email')->unique();
|
||||
$table->timestamp('email_verified_at')->nullable();
|
||||
$table->string('password');
|
||||
$table->rememberToken();
|
||||
$table->timestamps();
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function down()
|
||||
{
|
||||
Schema::dropIfExists('users');
|
||||
}
|
||||
};
|
||||
@@ -0,0 +1,32 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
return new class extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function up()
|
||||
{
|
||||
Schema::create('password_resets', function (Blueprint $table) {
|
||||
$table->string('email')->primary();
|
||||
$table->string('token');
|
||||
$table->timestamp('created_at')->nullable();
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function down()
|
||||
{
|
||||
Schema::dropIfExists('password_resets');
|
||||
}
|
||||
};
|
||||
@@ -0,0 +1,36 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
return new class extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function up()
|
||||
{
|
||||
Schema::create('failed_jobs', function (Blueprint $table) {
|
||||
$table->id();
|
||||
$table->string('uuid')->unique();
|
||||
$table->text('connection');
|
||||
$table->text('queue');
|
||||
$table->longText('payload');
|
||||
$table->longText('exception');
|
||||
$table->timestamp('failed_at')->useCurrent();
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function down()
|
||||
{
|
||||
Schema::dropIfExists('failed_jobs');
|
||||
}
|
||||
};
|
||||
@@ -0,0 +1,37 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
return new class extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function up()
|
||||
{
|
||||
Schema::create('personal_access_tokens', function (Blueprint $table) {
|
||||
$table->id();
|
||||
$table->morphs('tokenable');
|
||||
$table->string('name');
|
||||
$table->string('token', 64)->unique();
|
||||
$table->text('abilities')->nullable();
|
||||
$table->timestamp('last_used_at')->nullable();
|
||||
$table->timestamp('expires_at')->nullable();
|
||||
$table->timestamps();
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function down()
|
||||
{
|
||||
Schema::dropIfExists('personal_access_tokens');
|
||||
}
|
||||
};
|
||||
@@ -0,0 +1,36 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
class CreateMembersTable extends Migration
|
||||
{
|
||||
public function up()
|
||||
{
|
||||
Schema::create('members', function (Blueprint $table) {
|
||||
$table->id();
|
||||
|
||||
$table->string('unique_id', 50)->unique();
|
||||
$table->string('name');
|
||||
$table->string('picture')->nullable(); // store filename or URL, can be null
|
||||
|
||||
$table->enum('gender', ['male', 'female']);
|
||||
$table->date('date_of_birth');
|
||||
$table->string('nationality')->nullable();
|
||||
|
||||
$table->decimal('weight', 5, 2); // e.g., 123.45 kg max
|
||||
$table->decimal('height', 5, 2)->nullable(); // e.g., 250.00 cm max
|
||||
|
||||
$table->json('contact_info')->nullable(); // phones, emails as JSON
|
||||
$table->json('social_media')->nullable(); // social media links as JSON
|
||||
|
||||
$table->timestamps();
|
||||
});
|
||||
}
|
||||
|
||||
public function down()
|
||||
{
|
||||
Schema::dropIfExists('members');
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,27 @@
|
||||
<?php
|
||||
|
||||
namespace Database\Seeders;
|
||||
|
||||
// use Illuminate\Database\Console\Seeds\WithoutModelEvents;
|
||||
use Illuminate\Database\Seeder;
|
||||
|
||||
class DatabaseSeeder extends Seeder
|
||||
{
|
||||
/**
|
||||
* Seed the application's database.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function run()
|
||||
{
|
||||
// \App\Models\User::factory(10)->create();
|
||||
|
||||
// \App\Models\User::factory()->create([
|
||||
// 'name' => 'Test User',
|
||||
// 'email' => '[email protected]',
|
||||
// ]);
|
||||
|
||||
$this->call(MembersTableSeeder::class);
|
||||
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,61 @@
|
||||
<?php
|
||||
|
||||
namespace Database\Seeders;
|
||||
|
||||
use Illuminate\Database\Seeder;
|
||||
use App\Models\Member; // Make sure your Member model namespace is correct
|
||||
use Faker\Factory as Faker;
|
||||
use Illuminate\Support\Str;
|
||||
|
||||
class MembersTableSeeder extends Seeder
|
||||
{
|
||||
public function run()
|
||||
{
|
||||
$faker = Faker::create();
|
||||
|
||||
// Number of dummy members to create
|
||||
$count = 50;
|
||||
|
||||
for ($i = 0; $i < $count; $i++) {
|
||||
$gender = $faker->randomElement(['male', 'female']);
|
||||
|
||||
// Generate multiple phones & emails
|
||||
$phones = [
|
||||
$faker->phoneNumber,
|
||||
$faker->phoneNumber
|
||||
];
|
||||
|
||||
$emails = [
|
||||
$faker->unique()->safeEmail,
|
||||
$faker->unique()->safeEmail,
|
||||
];
|
||||
|
||||
// Generate social media profiles (randomly leave some empty)
|
||||
$socialMedia = [
|
||||
'facebook' => $faker->boolean(70) ? $faker->url : null,
|
||||
'instagram' => $faker->boolean(70) ? $faker->url : null,
|
||||
'twitter' => $faker->boolean(70) ? $faker->url : null,
|
||||
'linkedin' => $faker->boolean(50) ? $faker->url : null,
|
||||
];
|
||||
|
||||
// Filter out null social media links
|
||||
$socialMedia = array_filter($socialMedia);
|
||||
|
||||
Member::create([
|
||||
'name' => $faker->name($gender),
|
||||
'picture' => $faker->imageUrl(400, 400, 'people'), // Random 400x400 image
|
||||
'gender' => $gender,
|
||||
'date_of_birth' => $faker->dateTimeBetween('-50 years', '-6 years')->format('Y-m-d'), // Age 6 to 50 years
|
||||
'nationality' => $faker->country,
|
||||
'weight' => $faker->randomFloat(2, 30, 120), // Between 30kg and 120kg
|
||||
'height' => $faker->randomFloat(2, 140, 210), // Between 140cm and 210cm
|
||||
'contact_info' => json_encode([
|
||||
'phones' => $phones,
|
||||
'emails' => $emails,
|
||||
]),
|
||||
'social_media' => json_encode($socialMedia),
|
||||
// 'unique_id' will auto-generate via model observer
|
||||
]);
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user