commit21
This commit is contained in:
@@ -3,7 +3,9 @@
|
||||
namespace App\Models;
|
||||
|
||||
use App\Models\Concerns\BelongsToTenant;
|
||||
use Illuminate\Database\Eloquent\Builder;
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
use Illuminate\Database\Eloquent\Relations\BelongsTo;
|
||||
|
||||
/**
|
||||
* @property int $id
|
||||
@@ -29,6 +31,18 @@ class SupplierResponse extends Model
|
||||
return ['payload' => 'array', 'contributors' => 'array', 'decision' => 'array', 'reviewed_at' => 'datetime'];
|
||||
}
|
||||
|
||||
/** @param Builder<SupplierResponse> $query */
|
||||
public function scopeVisibleTo(Builder $query, User $actor): void
|
||||
{
|
||||
$query->where('tenant_id', $actor->tenant_id)->whereIn('supplier_evaluation_id', SupplierEvaluation::query()->visibleTo($actor)->select('id'));
|
||||
}
|
||||
|
||||
/** @return BelongsTo<SupplierEvaluation, $this> */
|
||||
public function evaluation(): BelongsTo
|
||||
{
|
||||
return $this->belongsTo(SupplierEvaluation::class, 'supplier_evaluation_id');
|
||||
}
|
||||
|
||||
protected static function booted(): void
|
||||
{
|
||||
static::updating(function (self $record) {
|
||||
|
||||
Reference in New Issue
Block a user