File manager - Edit - /home/bookdonate/htdocs/bookdonate.in/public/database.tar
Back
factories/UserFactory.php 0000777 00000001760 15227040303 0011511 0 ustar 00 <?php namespace Database\Factories; use Illuminate\Database\Eloquent\Factories\Factory; use Illuminate\Support\Str; use Illuminate\Support\Facades\Hash; use App\Models\User; /** * @extends \Illuminate\Database\Eloquent\Factories\Factory<\App\Models\User> */ class UserFactory extends Factory { protected $model = User::class; /** * 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' => Hash::make('123456'), '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, ]); } } migrations/2025_09_04_102309_create_settings_table.php 0000777 00000001114 15227040303 0016064 0 ustar 00 <?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() { Schema::create('settings', function (Blueprint $table) { $table->id(); $table->string('key')->unique(); $table->text('value')->nullable(); $table->timestamps(); }); } /** * Reverse the migrations. */ public function down(): void { Schema::dropIfExists('settings'); } }; migrations/2014_10_12_100000_create_password_resets_table.php 0000777 00000001235 15227040303 0017426 0 ustar 00 <?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')->index(); $table->string('token'); $table->timestamp('created_at')->nullable(); }); } /** * Reverse the migrations. * * @return void */ public function down() { Schema::dropIfExists('password_resets'); } }; migrations/2014_10_12_000000_create_users_table.php 0000777 00000001357 15227040303 0015344 0 ustar 00 <?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->timestamp('email_verified_at')->nullable(); $table->string('password'); $table->rememberToken(); $table->timestamps(); }); } /** * Reverse the migrations. */ public function down(): void { Schema::dropIfExists('users'); } }; migrations/2019_08_19_000000_create_failed_jobs_table.php 0000777 00000001400 15227040303 0016454 0 ustar 00 <?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'); } }; migrations/2025_08_22_094910_create_sessions_table.php 0000777 00000001416 15227040303 0016106 0 ustar 00 <?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('sessions', function (Blueprint $table) { $table->string('id')->primary(); $table->uuid('user_id')->nullable()->index(); $table->string('ip_address', 45)->nullable(); $table->text('user_agent')->nullable(); $table->longText('payload'); $table->integer('last_activity')->index(); }); } /** * Reverse the migrations. */ public function down(): void { Schema::dropIfExists('sessions'); } }; migrations/2025_08_22_113040_create_blogs_table.php 0000777 00000001521 15227040303 0015325 0 ustar 00 <?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('blogs', function (Blueprint $table) { $table->uuid('id')->primary(); $table->string('title'); $table->string('slug'); $table->longText('description')->nullable(); $table->string('image')->nullable(); $table->boolean('status')->default(1); $table->uuid('created_by'); $table->softDeletes(); $table->timestamps(); }); } /** * Reverse the migrations. */ public function down(): void { Schema::dropIfExists('blogs'); } }; migrations/2025_07_23_103141_create_admins_table.php 0000777 00000001602 15227040303 0015473 0 ustar 00 <?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('admins', function (Blueprint $table) { $table->uuid('id')->primary(); $table->string('name'); $table->string('email')->unique(); $table->string('password'); $table->boolean('is_super')->default(false); $table->string('image')->nullable(); $table->rememberToken(); $table->boolean('status')->default(1); $table->softDeletes(); $table->timestamps(); }); } /** * Reverse the migrations. */ public function down(): void { Schema::dropIfExists('admins'); } }; migrations/2025_08_22_113039_create_blog_categories_table.php 0000777 00000001475 15227040303 0017367 0 ustar 00 <?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('blog_categories', function (Blueprint $table) { $table->uuid('id')->primary(); $table->string('title'); $table->string('slug'); $table->longText('description')->nullable(); $table->string('image')->nullable(); $table->boolean('status')->default(1); $table->softDeletes(); $table->timestamps(); }); } /** * Reverse the migrations. */ public function down(): void { Schema::dropIfExists('blog_categories'); } }; migrations/2019_12_14_000001_create_personal_access_tokens_table.php 0000777 00000001530 15227040303 0020735 0 ustar 00 <?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'); } }; migrations/2025_07_23_103142_create_cache_table.php 0000777 00000001521 15227040303 0015264 0 ustar 00 <?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('cache', function (Blueprint $table) { $table->string('key')->primary(); $table->mediumText('value'); $table->integer('expiration'); }); Schema::create('cache_locks', function (Blueprint $table) { $table->string('key')->primary(); $table->string('owner'); $table->integer('expiration'); }); } /** * Reverse the migrations. */ public function down(): void { Schema::dropIfExists('cache'); Schema::dropIfExists('cache_locks'); } }; migrations/2025_08_22_113038_add_status_to_roles_table.php 0000777 00000001217 15227040303 0016746 0 ustar 00 <?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::table('roles', function (Blueprint $table) { $table->boolean('status')->default(1)->after('guard_name'); // 1 = Active, 0 = Inactive }); } /** * Reverse the migrations. */ public function down(): void { Schema::table('roles', function (Blueprint $table) { $table->dropColumn('status'); }); } }; migrations/2025_07_23_104350_create_permission_tables.php 0000777 00000014562 15227040303 0016607 0 ustar 00 <?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 { $teams = config('permission.teams'); $tableNames = config('permission.table_names'); $columnNames = config('permission.column_names'); $pivotRole = $columnNames['role_pivot_key'] ?? 'role_id'; $pivotPermission = $columnNames['permission_pivot_key'] ?? 'permission_id'; if (empty($tableNames)) { throw new \Exception('Error: config/permission.php not loaded. Run [php artisan config:clear] and try again.'); } if ($teams && empty($columnNames['team_foreign_key'] ?? null)) { throw new \Exception('Error: team_foreign_key on config/permission.php not loaded. Run [php artisan config:clear] and try again.'); } Schema::create($tableNames['permissions'], static function (Blueprint $table) { // $table->engine('InnoDB'); $table->uuid('id')->primary(); // permission id $table->string('name',225); // For MyISAM use string('name', 225); // (or 166 for InnoDB with Redundant/Compact row format) $table->string('guard_name',225); // For MyISAM use string('guard_name', 25); $table->string('module'); $table->timestamps(); // $table->unique('guard_name'); }); Schema::create($tableNames['roles'], static function (Blueprint $table) use ($teams, $columnNames) { // $table->engine('InnoDB'); $table->uuid('id')->primary(); if ($teams || config('permission.testing')) { // permission.testing is a fix for sqlite testing $table->unsignedBigInteger($columnNames['team_foreign_key'])->nullable(); $table->index($columnNames['team_foreign_key'], 'roles_team_foreign_key_index'); } $table->string('name'); // For MyISAM use string('name', 225); // (or 166 for InnoDB with Redundant/Compact row format) $table->string('guard_name'); // For MyISAM use string('guard_name', 25); $table->timestamps(); // if ($teams || config('permission.testing')) { // $table->unique([$columnNames['team_foreign_key'], 'name', 'guard_name']); // } else { // $table->unique('guard_name'); // } }); Schema::create($tableNames['model_has_permissions'], static function (Blueprint $table) use ($tableNames, $columnNames, $pivotPermission, $teams) { $table->uuid($pivotPermission); $table->string('model_type'); $table->uuid($columnNames['model_morph_key']); $table->index([$columnNames['model_morph_key'], 'model_type'], 'model_has_permissions_model_id_model_type_index'); $table->foreign($pivotPermission) ->references('id') // permission id ->on($tableNames['permissions']) ->onDelete('cascade'); if ($teams) { $table->uuid($columnNames['team_foreign_key']); $table->index($columnNames['team_foreign_key'], 'model_has_permissions_team_foreign_key_index'); $table->primary([$columnNames['team_foreign_key'], $pivotPermission, $columnNames['model_morph_key'], 'model_type'], 'model_has_permissions_permission_model_type_primary'); } else { $table->primary([$pivotPermission, $columnNames['model_morph_key'], 'model_type'], 'model_has_permissions_permission_model_type_primary'); } }); Schema::create($tableNames['model_has_roles'], static function (Blueprint $table) use ($tableNames, $columnNames, $pivotRole, $teams) { $table->uuid($pivotRole); $table->string('model_type'); $table->uuid($columnNames['model_morph_key']); $table->index([$columnNames['model_morph_key'], 'model_type'], 'model_has_roles_model_id_model_type_index'); $table->foreign($pivotRole) ->references('id') // role id ->on($tableNames['roles']) ->onDelete('cascade'); if ($teams) { $table->uuid($columnNames['team_foreign_key']); $table->index($columnNames['team_foreign_key'], 'model_has_roles_team_foreign_key_index'); $table->primary([$columnNames['team_foreign_key'], $pivotRole, $columnNames['model_morph_key'], 'model_type'], 'model_has_roles_role_model_type_primary'); } else { $table->primary([$pivotRole, $columnNames['model_morph_key'], 'model_type'], 'model_has_roles_role_model_type_primary'); } }); Schema::create($tableNames['role_has_permissions'], static function (Blueprint $table) use ($tableNames, $pivotRole, $pivotPermission) { $table->uuid($pivotPermission); $table->uuid($pivotRole); $table->foreign($pivotPermission) ->references('id') // permission id ->on($tableNames['permissions']) ->onDelete('cascade'); $table->foreign($pivotRole) ->references('id') // role id ->on($tableNames['roles']) ->onDelete('cascade'); $table->primary([$pivotPermission, $pivotRole], 'role_has_permissions_permission_id_role_id_primary'); }); app('cache') ->store(config('permission.cache.store') != 'default' ? config('permission.cache.store') : null) ->forget(config('permission.cache.key')); } /** * Reverse the migrations. */ public function down(): void { $tableNames = config('permission.table_names'); if (empty($tableNames)) { throw new \Exception('Error: config/permission.php not found and defaults could not be merged. Please publish the package configuration before proceeding, or drop the tables manually.'); } Schema::drop($tableNames['role_has_permissions']); Schema::drop($tableNames['model_has_roles']); Schema::drop($tableNames['model_has_permissions']); Schema::drop($tableNames['roles']); Schema::drop($tableNames['permissions']); } }; migrations/2025_08_22_113041_create_blog_category_manages_table.php 0000777 00000001602 15227040303 0020533 0 ustar 00 <?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('blog_category_manages', function (Blueprint $table) { $table->uuid('id')->primary(); $table->uuid('blog_id'); $table->uuid('blog_category_id'); $table->softDeletes(); $table->timestamps(); $table->foreign('blog_id')->references('id')->on('blogs')->onDelete('cascade'); $table->foreign('blog_category_id')->references('id')->on('blog_categories')->onDelete('cascade'); }); } /** * Reverse the migrations. */ public function down(): void { Schema::dropIfExists('blog_category_manages'); } }; migrations/2014_10_12_100000_create_password_reset_tokens_table.php 0000777 00000001201 15227040303 0020617 0 ustar 00 <?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'); } }; .gitignore 0000777 00000000012 15227040303 0006530 0 ustar 00 *.sqlite* seeders/UserTableSeeder.php 0000777 00000000506 15227040303 0011731 0 ustar 00 <?php namespace Database\Seeders; use Illuminate\Database\Console\Seeds\WithoutModelEvents; use Illuminate\Database\Seeder; use App\Models\User; class UserTableSeeder extends Seeder { /** * Run the database seeds. */ public function run(): void { User::factory()->count(5)->create(); } } seeders/AssignRoleToAdminSeeder.php 0000777 00000000711 15227040303 0013363 0 ustar 00 <?php namespace Database\Seeders; use App\Models\Admin; use Spatie\Permission\Models\Role; use Illuminate\Database\Seeder; class AssignRoleToAdminSeeder extends Seeder { public function run() { $admin = \App\Models\Admin::first(); // ya specific admin id $role = Role::where('name', 'Super Admin')->where('guard_name', 'admin')->first(); if ($admin && $role) { $admin->assignRole($role); } } } ?>