user softdelete

This commit is contained in:
StudioTem committed 2023-07-13 10:38:16 +02:00
1 parent d3f6d8a643
commit 4d4cb643ec
10 files changed
+53 -18

No files matched your search

+1 -1
View File
@@ -15,7 +15,7 @@ class Blocker extends Model
public function user()
{
return $this->belongsTo(User::class);
return $this->belongsTo(User::class)->withTrashed();
}
public function getColorAttribute()
+2 -4
View File
@@ -35,18 +35,16 @@ class MasterTask extends Model
// vracia userov, ktori su priradeni k subtasku ale nepatria do teamu
public function getUsersOutsideTeamAttribute()
{
$users = $this->subtasks->pluck('user')->unique();
//remove null values - priprady, kedy bol user zmazany
$users = $users->filter();
// ak nie je uvedeny ziaden team, tak sa vratia vsetci useri
if (!$this->team){
return $users;
}
return $users->filter(function ($user) {
return !in_array($this->team->id, isset($user->teams) ? $user->teams->pluck('id')->unique()->toArray() : []);
return !in_array($this->team->id, $user->teams->pluck('id')->unique()->toArray());
});
}
+1 -1
View File
@@ -20,7 +20,7 @@ class SubTask extends Model
public function user()
{
return $this->belongsTo(User::class);
return $this->belongsTo(User::class)->withTrashed();
}
public function timeblocks()
+1 -1
View File
@@ -15,6 +15,6 @@ class Team extends Model
public function users()
{
return $this->belongsToMany(User::class);
return $this->belongsToMany(User::class)->withTrashed();
}
}
+1 -1
View File
@@ -22,6 +22,6 @@ class Timesheet extends Model
public function user()
{
return $this->belongsTo(User::class);
return $this->belongsTo(User::class)->withTrashed();
}
}
+2 -4
View File
@@ -2,18 +2,16 @@
namespace App\Models;
use App\Mail\PasswordReset;
use Illuminate\Database\Eloquent\Factories\HasFactory;
use Illuminate\Foundation\Auth\User as Authenticatable;
use Illuminate\Http\Request;
use Illuminate\Notifications\Notifiable;
use Illuminate\Support\Facades\Mail;
use Laravel\Sanctum\HasApiTokens;
use Laravel\Sanctum\PersonalAccessToken;
use Illuminate\Database\Eloquent\SoftDeletes;
class User extends Authenticatable
{
use HasApiTokens, HasFactory, Notifiable;
use HasApiTokens, HasFactory, Notifiable, SoftDeletes;
/**
* The attributes that are mass assignable.