Multi-user OSINT investigation tool with owner-controlled per-user and per-group access grants. Includes Sherlock, theHarvester, crt.sh, WHOIS, and ip-api.com collectors wired through a pluggable Runner/queue pipeline, investigation search, and printable/CSV/JSON reporting. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
40 lines
1.0 KiB
PHP
40 lines
1.0 KiB
PHP
<?php
|
|
|
|
namespace App\Models;
|
|
|
|
use Illuminate\Database\Eloquent\Attributes\Fillable;
|
|
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
|
use Illuminate\Database\Eloquent\Model;
|
|
use Illuminate\Database\Eloquent\Relations\BelongsTo;
|
|
use Illuminate\Database\Eloquent\Relations\BelongsToMany;
|
|
use Illuminate\Database\Eloquent\Relations\HasMany;
|
|
|
|
#[Fillable(['name', 'description', 'owner_id'])]
|
|
class Group extends Model
|
|
{
|
|
use HasFactory;
|
|
|
|
public function owner(): BelongsTo
|
|
{
|
|
return $this->belongsTo(User::class, 'owner_id');
|
|
}
|
|
|
|
public function members(): BelongsToMany
|
|
{
|
|
return $this->belongsToMany(User::class)->withTimestamps();
|
|
}
|
|
|
|
public function investigations(): BelongsToMany
|
|
{
|
|
return $this->belongsToMany(Investigation::class, 'investigation_group')
|
|
->withPivot('role')
|
|
->withTimestamps();
|
|
}
|
|
|
|
public function isAccessibleBy(User $user): bool
|
|
{
|
|
return $this->owner_id === $user->id
|
|
|| $this->members()->where('users.id', $user->id)->exists();
|
|
}
|
|
}
|