Add multi-branch POS with team roles and branch-scoped cashiers.
Deploy Ladill POS / deploy (push) Successful in 1m58s
Deploy Ladill POS / deploy (push) Successful in 1m58s
Pro and Business users can manage branches, invite cashiers with branch assignment, and switch registers; sales and register flows respect acting location. Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
@@ -0,0 +1,27 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
return new class extends Migration
|
||||
{
|
||||
public function up(): void
|
||||
{
|
||||
Schema::create('pos_members', function (Blueprint $table) {
|
||||
$table->id();
|
||||
$table->string('owner_ref')->index();
|
||||
$table->string('user_ref')->index();
|
||||
$table->string('role', 30)->default('cashier');
|
||||
$table->foreignId('location_id')->nullable()->constrained('pos_locations')->nullOnDelete();
|
||||
$table->timestamps();
|
||||
|
||||
$table->unique(['owner_ref', 'user_ref']);
|
||||
});
|
||||
}
|
||||
|
||||
public function down(): void
|
||||
{
|
||||
Schema::dropIfExists('pos_members');
|
||||
}
|
||||
};
|
||||
@@ -0,0 +1,34 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\DB;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
return new class extends Migration
|
||||
{
|
||||
public function up(): void
|
||||
{
|
||||
Schema::table('pos_locations', function (Blueprint $table) {
|
||||
$table->boolean('is_default')->default(false)->after('currency');
|
||||
});
|
||||
|
||||
$defaults = DB::table('pos_locations')
|
||||
->select('owner_ref', DB::raw('MIN(id) as id'))
|
||||
->groupBy('owner_ref')
|
||||
->get();
|
||||
|
||||
foreach ($defaults as $row) {
|
||||
DB::table('pos_locations')
|
||||
->where('id', $row->id)
|
||||
->update(['is_default' => true]);
|
||||
}
|
||||
}
|
||||
|
||||
public function down(): void
|
||||
{
|
||||
Schema::table('pos_locations', function (Blueprint $table) {
|
||||
$table->dropColumn('is_default');
|
||||
});
|
||||
}
|
||||
};
|
||||
Reference in New Issue
Block a user