This commit is contained in:
2025-10-22 20:08:22 +05:00
commit 736e3bef18
2573 changed files with 120385 additions and 0 deletions

View File

@@ -0,0 +1,49 @@
<?php
namespace App\Modules\UserAdjustments\Controllers;
use App\Http\Controllers\Controller;
use Illuminate\Http\Request;
class UserAdjustmentsController extends Controller
{
/**
* Display a listing of the resource.
*/
public function index(Request $request): void
{
//
}
/**
* Store a newly created resource in storage.
*/
public function store(Request $request): void
{
//
}
/**
* Display the specified resource.
*/
public function show(Request $request): void
{
//
}
/**
* Update the specified resource in storage.
*/
public function update(Request $request): void
{
//
}
/**
* Remove the specified resource from storage.
*/
public function destroy(Request $request): void
{
//
}
}

View File

@@ -0,0 +1,53 @@
<?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('users', function (Blueprint $table) {
$table->string('email')->nullable()->change();
$table->string('username')->unique();
$table->string('first_name')->nullable();
$table->string('last_name')->nullable();
$table->string('phone')->nullable()->unique();
$table->timestamp('phone_verified_at')->nullable();
$table->string('locale')->default('tk');
$table->boolean('password_must_be_changed')->default(false);
$table->json('options')->nullable();
});
}
/**
* Reverse the migrations.
*/
public function down(): void
{
Schema::table('users', function (Blueprint $table) {
$table->string('email')->change();
$table->dropColumn('username');
$table->dropColumn('first_name');
$table->dropColumn('last_name');
$table->dropColumn('phone');
$table->dropColumn('phone_verified_at');
$table->dropColumn('locale');
$table->dropColumn('password_must_be_changed');
$table->dropColumn('options');
});
}
};

View File

@@ -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::table('users', function (Blueprint $table) {
$table->boolean('must_fill_profile')->default(false);
});
}
/**
* Reverse the migrations.
*/
public function down(): void
{
Schema::table('users', function (Blueprint $table) {
$table->dropColumn('must_fill_profile');
});
}
};

View File

@@ -0,0 +1,43 @@
<?php
namespace App\Modules\UserAdjustments\Traits;
/**
* @property string $username [unique]
* @property string|null $first_name
* @property string|null $last_name
* @property string|null $phone
* @property \Illuminate\Support\Facades\Date|null $phone_verified_at
* @property string $locale [default: tk]
* @property bool $password_must_be_changed [default: false]
* @property bool $must_fill_profile [default: false]
* @property null|array $options
*/
trait UserAdjustments
{
/**
* Get the attributes that should be cast.
*
* @return array<string, string>
*/
protected function casts(): array
{
return [
'email_verified_at' => 'datetime',
'phone_verified_at' => 'datetime',
'password_must_be_changed' => 'bool',
'must_fill_profile' => 'bool',
'options' => 'array',
'custom_fields' => 'array',
'password' => 'hashed',
];
}
/**
* Get option from options
*/
public function getOption(string $option): null|int|string
{
return $this->options && array_key_exists($option, $this->options) ? $this->options[$option] : '';
}
}

View File

@@ -0,0 +1,64 @@
<?php
namespace App\Modules\UserAdjustments;
use App\Modules\Makeable;
use App\Modules\ModuleContract;
class UserAdjustmentsModule implements ModuleContract
{
use Makeable;
/**
* Module is enabled
*/
protected bool $enabled = true;
/**
* Check if is module enabled
*/
public function isEnabled(): bool
{
return $this->enabled;
}
/**
* Disable module
*/
public function disable(): void
{
$this->enabled = false;
}
/**
* Enable module
*/
public function enable(): void
{
$this->enabled = true;
}
/**
* Check if module has a filament resource
*/
public function hasFilamentResource(): bool
{
return false;
}
/**
* Get module composer requirements
*/
public function getComposerRequirements(): array
{
return [];
}
/**
* Get module composer suggestions
*/
public function getComposerSuggestions(): array
{
return [];
}
}

View File

@@ -0,0 +1,17 @@
# 1.0.0
> Add below fields to users table
```php
string('username')->unique();
string('first_name')->nullable();
string('last_name')->nullable();
integer('phone')->nullable()->unique();
dateTime('phone_verified_at')->nullable();
string('locale')->default('tk');
boolean('password_must_be_changed')->default(false);
json('options')->nullable()
```