mirror of
https://github.com/solidtime-io/solidtime.git
synced 2026-08-14 11:12:16 +01:00
Add roles for project members; Restrict access to sensitive project values
This commit is contained in:
@@ -4,6 +4,7 @@ declare(strict_types=1);
|
||||
|
||||
namespace Database\Factories;
|
||||
|
||||
use App\Enums\ProjectMemberRole;
|
||||
use App\Models\Member;
|
||||
use App\Models\Project;
|
||||
use App\Models\ProjectMember;
|
||||
@@ -24,12 +25,22 @@ class ProjectMemberFactory extends Factory
|
||||
{
|
||||
return [
|
||||
'billable_rate' => $this->faker->numberBetween(10, 10000) * 100,
|
||||
'role' => ProjectMemberRole::Normal,
|
||||
'project_id' => Project::factory(),
|
||||
'user_id' => User::factory(),
|
||||
'member_id' => Member::factory(),
|
||||
];
|
||||
}
|
||||
|
||||
public function role(ProjectMemberRole $role): self
|
||||
{
|
||||
return $this->state(function (array $attributes) use ($role) {
|
||||
return [
|
||||
'role' => $role,
|
||||
];
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* @deprecated Use forMember instead
|
||||
*/
|
||||
|
||||
@@ -0,0 +1,30 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
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('project_members', function (Blueprint $table): void {
|
||||
$table->string('role')->default('normal');
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*/
|
||||
public function down(): void
|
||||
{
|
||||
Schema::table('project_members', function (Blueprint $table): void {
|
||||
$table->dropColumn('role');
|
||||
});
|
||||
}
|
||||
};
|
||||
Reference in New Issue
Block a user