This commit is contained in:
Mekan1206
2026-04-30 19:50:59 +05:00
parent 6dc6802445
commit a07c764dfe
142 changed files with 2709 additions and 1914 deletions

View File

@@ -19,10 +19,10 @@ class CreatePermissionTables extends Migration
$teams = config('permission.teams');
if (empty($tableNames)) {
throw new \Exception('Error: config/permission.php not loaded. Run [php artisan config:clear] and try again.');
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.');
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'], function (Blueprint $table) {
@@ -133,7 +133,7 @@ class CreatePermissionTables extends Migration
$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.');
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']);

View File

@@ -9,7 +9,7 @@ class CreateViewsTable extends Migration
/**
* The database schema.
*
* @var \Illuminate\Support\Facades\Schema
* @var Schema
*/
protected $schema;

View File

@@ -1,8 +1,6 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
use Illuminate\Support\Facades\DB;
return new class extends Migration

View File

@@ -0,0 +1,47 @@
<?php
declare(strict_types=1);
use BasementChat\Basement\Enums\MessageType;
use Illuminate\Database\Eloquent\Model;
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('private_messages', static function (Blueprint $table): void {
/** @var string $model */
$model = config('basement.user_model');
/** @var Model $user */
$user = app($model);
$primaryKey = $user->getKeyName();
$tableName = $user->getTable();
$table->id();
$table->unsignedBigInteger('receiver_id');
$table->unsignedBigInteger('sender_id');
$table->foreign('receiver_id')->references($primaryKey)->on($tableName);
$table->foreign('sender_id')->references($primaryKey)->on($tableName);
$table->enum('type', [MessageType::document()->value, MessageType::text()->value]);
$table->string('value');
$table->timestamp('read_at')->nullable();
$table->timestamps();
$table->softDeletes();
});
}
/**
* Reverse the migrations.
*/
public function down(): void
{
Schema::dropIfExists('private_messages');
}
};