This commit is contained in:
Simon Pocrnjič
2025-09-26 06:02:59 +02:00
parent a8383d3a69
commit d17e34941b
11 changed files with 552 additions and 30 deletions
+1 -1
View File
@@ -14,7 +14,7 @@ class Action extends Model
use HasFactory;
use Searchable;
protected $fillable = ['name', 'color_tag'];
protected $fillable = ['name', 'color_tag', 'segment_id'];
public function decisions(): BelongsToMany
{
+12
View File
@@ -18,6 +18,7 @@ class Activity extends Model
'amount',
'note',
'action_id',
'user_id',
'decision_id'
];
@@ -25,9 +26,20 @@ class Activity extends Model
'action_id',
'decision_id',
'client_case_id',
'user_id',
'contract_id'
];
protected static function booted(){
static::creating(function (Activity $activity) {
if(!isset($activity->user_id)){
$activity->user_id = auth()->id();
}
});
}
public function action(): BelongsTo
{
return $this->belongsTo(\App\Models\Action::class);
+2
View File
@@ -13,6 +13,8 @@ class Decision extends Model
/** @use HasFactory<\Database\Factories\DecisionFactory> */
use HasFactory;
protected $fillable = ['name', 'color_tag'];
public function actions(): BelongsToMany
{
return $this->belongsToMany(\App\Models\Action::class);