first commit
This commit is contained in:
1
database/.gitignore
vendored
Normal file
1
database/.gitignore
vendored
Normal file
@@ -0,0 +1 @@
|
||||
*.sqlite*
|
||||
38
database/factories/UserFactory.php
Normal file
38
database/factories/UserFactory.php
Normal file
@@ -0,0 +1,38 @@
|
||||
<?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(): array
|
||||
{
|
||||
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.
|
||||
*/
|
||||
public function unverified(): static
|
||||
{
|
||||
return $this->state(fn (array $attributes) => [
|
||||
'email_verified_at' => null,
|
||||
]);
|
||||
}
|
||||
}
|
||||
40
database/migrations/2014_10_12_000000_create_users_table.php
Normal file
40
database/migrations/2014_10_12_000000_create_users_table.php
Normal file
@@ -0,0 +1,40 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
return new class extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*/
|
||||
public function up(): void
|
||||
{
|
||||
Schema::create('users', function (Blueprint $table) {
|
||||
$table->id();
|
||||
$table->string('name');
|
||||
$table->string('email')->unique();
|
||||
$table->string('country_code')->nullable();
|
||||
$table->string('phone')->nullable();
|
||||
$table->string('password');
|
||||
$table->text('notification_token')->nullable();
|
||||
$table->text('image')->nullable();
|
||||
$table->enum('type',['super_admin','admin','manager','waiter','client'])->default('client');
|
||||
$table->timestamp('email_verified_at')->nullable();
|
||||
$table->timestamp('phone_verified_at')->nullable();
|
||||
$table->enum('status',['inactive','active','blocked','other','deleted','under_deletion'])->default('active');
|
||||
$table->string('status_reason')->nullable();
|
||||
$table->rememberToken();
|
||||
$table->timestamps();
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*/
|
||||
public function down(): void
|
||||
{
|
||||
Schema::dropIfExists('users');
|
||||
}
|
||||
};
|
||||
@@ -0,0 +1,28 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
return new class extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*/
|
||||
public function up(): void
|
||||
{
|
||||
Schema::create('password_reset_tokens', function (Blueprint $table) {
|
||||
$table->string('email')->primary();
|
||||
$table->string('token');
|
||||
$table->timestamp('created_at')->nullable();
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*/
|
||||
public function down(): void
|
||||
{
|
||||
Schema::dropIfExists('password_reset_tokens');
|
||||
}
|
||||
};
|
||||
@@ -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.
|
||||
*/
|
||||
public function up(): void
|
||||
{
|
||||
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.
|
||||
*/
|
||||
public function down(): void
|
||||
{
|
||||
Schema::dropIfExists('failed_jobs');
|
||||
}
|
||||
};
|
||||
@@ -0,0 +1,33 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
return new class extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*/
|
||||
public function up(): void
|
||||
{
|
||||
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.
|
||||
*/
|
||||
public function down(): void
|
||||
{
|
||||
Schema::dropIfExists('personal_access_tokens');
|
||||
}
|
||||
};
|
||||
@@ -0,0 +1,29 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
return new class extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*/
|
||||
public function up(): void
|
||||
{
|
||||
Schema::create('settings', function (Blueprint $table) {
|
||||
$table->id();
|
||||
$table->string('key');
|
||||
$table->string('value');
|
||||
$table->timestamps();
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*/
|
||||
public function down(): void
|
||||
{
|
||||
Schema::dropIfExists('settings');
|
||||
}
|
||||
};
|
||||
@@ -0,0 +1,26 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
return new class extends Migration
|
||||
{
|
||||
public function up()
|
||||
{
|
||||
Schema::create('categories', function (Blueprint $table) {
|
||||
$table->id();
|
||||
$table->json('title');
|
||||
$table->json('description')->nullable();
|
||||
$table->integer('sortingIndex')->default(0);
|
||||
$table->boolean('isActive')->default(true);
|
||||
$table->string('thumbnail')->nullable();
|
||||
$table->timestamps();
|
||||
});
|
||||
}
|
||||
|
||||
public function down()
|
||||
{
|
||||
Schema::dropIfExists('categories');
|
||||
}
|
||||
};
|
||||
29
database/migrations/2024_03_21_000000_create_menus_table.php
Normal file
29
database/migrations/2024_03_21_000000_create_menus_table.php
Normal file
@@ -0,0 +1,29 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
return new class extends Migration
|
||||
{
|
||||
public function up()
|
||||
{
|
||||
Schema::create('menus', function (Blueprint $table) {
|
||||
$table->id();
|
||||
$table->integer('menu_id')->nullable();
|
||||
$table->json('title');
|
||||
$table->json('description')->nullable();
|
||||
$table->decimal('price', 10, 2);
|
||||
$table->string('image')->nullable();
|
||||
$table->boolean('isActive')->default(true);
|
||||
$table->unsignedBigInteger('category_id');
|
||||
$table->foreign('category_id')->references('id')->on('categories')->onDelete('cascade');
|
||||
$table->timestamps();
|
||||
});
|
||||
}
|
||||
|
||||
public function down()
|
||||
{
|
||||
Schema::dropIfExists('menus');
|
||||
}
|
||||
};
|
||||
139
database/seeders/DatabaseSeeder.php
Normal file
139
database/seeders/DatabaseSeeder.php
Normal file
@@ -0,0 +1,139 @@
|
||||
<?php
|
||||
|
||||
namespace Database\Seeders;
|
||||
|
||||
use App\Models\MobileAppCategory;
|
||||
use App\Models\Subscription;
|
||||
use App\Models\User;
|
||||
use App\Models\Setting;
|
||||
use App\Models\PaymentMethod;
|
||||
use Illuminate\Database\Seeder;
|
||||
|
||||
class DatabaseSeeder extends Seeder
|
||||
{
|
||||
/**
|
||||
* Seed the application's database.
|
||||
*/
|
||||
public function run(): void
|
||||
{
|
||||
User::create([
|
||||
'name' => 'Super Admin',
|
||||
'password' => bcrypt('12345678'),
|
||||
'email' => 'suepr_admin@gmail.com',
|
||||
'email_verified_at' => now(),
|
||||
'country_code'=>'+92',
|
||||
'phone' => '3286493155',
|
||||
'type' => 'super_admin',
|
||||
]);
|
||||
|
||||
User::create([
|
||||
'name' => 'Admin',
|
||||
'password' => bcrypt('12345678'),
|
||||
'email' => 'admin@gmail.com',
|
||||
'email_verified_at' => now(),
|
||||
'country_code'=>'+92',
|
||||
'phone' => '3286493155',
|
||||
'type' => 'admin',
|
||||
]);
|
||||
|
||||
User::create([
|
||||
'name' => 'Client',
|
||||
'password' => bcrypt('12345678'),
|
||||
'email' => 'client@gmail.com',
|
||||
'email_verified_at' => now(),
|
||||
'country_code'=>'+92',
|
||||
'phone' => '3286493155',
|
||||
'type' => 'client',
|
||||
]);
|
||||
|
||||
User::create([
|
||||
'name' => 'Waiter',
|
||||
'password' => bcrypt('12345678'),
|
||||
'email' => 'waiter@gmail.com',
|
||||
'email_verified_at' => now(),
|
||||
'country_code'=>'+92',
|
||||
'phone' => '3286493155',
|
||||
'type' => 'waiter',
|
||||
]);
|
||||
|
||||
|
||||
Setting::create([
|
||||
'key' => 'currency',
|
||||
'value' => '€'
|
||||
]);
|
||||
|
||||
Setting::create([
|
||||
'key' => 'terms_and_conditions',
|
||||
'value' => 'https://magnificentservices.net'
|
||||
]);
|
||||
|
||||
Setting::create([
|
||||
'key' => 'support_email',
|
||||
'value' => 'support@magnificentservices.net'
|
||||
]);
|
||||
|
||||
Setting::create([
|
||||
'key' => 'support_phone',
|
||||
'value' => '+923286493155'
|
||||
]);
|
||||
|
||||
|
||||
Setting::create([
|
||||
'key' => 'is_email_verification_mandatory',
|
||||
'value' => '0'
|
||||
]);
|
||||
|
||||
Setting::create([
|
||||
'key' => 'is_phone_verification_mandatory',
|
||||
'value' => '0'
|
||||
]);
|
||||
|
||||
// If primary verification method is phone than phone verification is mandatory - If primary verification method is email than email verification is mandatory - If primary verification method is none than check for email and phone verification items.
|
||||
Setting::create([
|
||||
'key' => 'primary_verification_method',
|
||||
'value' => 'phone'
|
||||
]);
|
||||
|
||||
Setting::create([
|
||||
'key' => 'admin_pannel_version_code',
|
||||
'value' => '1'
|
||||
]);
|
||||
|
||||
Setting::create([
|
||||
'key' => 'android_version_code',
|
||||
'value' => '1'
|
||||
]);
|
||||
|
||||
Setting::create([
|
||||
'key' => 'ios_version_code',
|
||||
'value' => '1'
|
||||
]);
|
||||
|
||||
Setting::create([
|
||||
'key' => 'android_update_type',
|
||||
'value' => '0'
|
||||
]);
|
||||
|
||||
Setting::create([
|
||||
'key' => 'ios_update_type',
|
||||
'value' => '0'
|
||||
]);
|
||||
|
||||
Setting::create([
|
||||
'key' => 'update_message',
|
||||
'value' => 'Performance improvements. Bug Fixes.'
|
||||
]);
|
||||
|
||||
|
||||
Setting::create([
|
||||
'key' => 'android_update_url',
|
||||
'value' => 'https://magnificentservices.net'
|
||||
]);
|
||||
|
||||
Setting::create([
|
||||
'key' => 'ios_update_url',
|
||||
'value' => 'https://magnificentservices.net'
|
||||
]);
|
||||
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user