This commit is contained in:
2026-11-03 11:51:44 +02:00
parent badaada043
commit e753f7a0a4
309 changed files with 14537 additions and 529 deletions
+29
View File
@@ -0,0 +1,29 @@
<?php
namespace App\Models;
use App\Models\Concerns\AppendOnlyInventoryRecord;
use App\Models\Concerns\BelongsToTenant;
use Illuminate\Database\Eloquent\Model;
/** @property int $id
* @property int $goods_receipt_id
* @property string $path
* @property string $sha256
* @property string $original_name
*/
class ReceiptDocument extends Model
{
use AppendOnlyInventoryRecord, BelongsToTenant;
public $timestamps = false;
protected $guarded = ['id'];
protected $hidden = ['path', 'tenant_id'];
protected function casts(): array
{
return ['created_at' => 'datetime'];
}
}
+14
View File
@@ -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) {
+3 -1
View File
@@ -11,6 +11,7 @@ use Illuminate\Database\Eloquent\Factories\HasFactory;
use Illuminate\Foundation\Auth\User as Authenticatable;
use Illuminate\Notifications\Notifiable;
use Illuminate\Support\Carbon;
use Laravel\Fortify\TwoFactorAuthenticatable;
/**
* @property int $id
@@ -44,7 +45,7 @@ class User extends Authenticatable
}
/** @use HasFactory<UserFactory> */
use HasFactory, Notifiable;
use HasFactory, Notifiable, TwoFactorAuthenticatable;
/**
* Get the attributes that should be cast.
@@ -56,6 +57,7 @@ class User extends Authenticatable
return [
'purchasing_role' => PurchasingRole::class,
'email_verified_at' => 'datetime',
'two_factor_confirmed_at' => 'datetime',
'password' => 'hashed',
];
}