mirror of
https://bitbucket.org/studiotem/jandl-taskmanager-app.git
synced 2026-10-21 14:29:34 +00:00
user softdelete
This commit is contained in:
1 parent
d3f6d8a643
commit
4d4cb643ec
10 files changed
+53
-18
No files matched your search
@@ -28,7 +28,10 @@ class SendDeletedSubTaskNotification
|
|||||||
public function handle(SubTaskDeleted $event)
|
public function handle(SubTaskDeleted $event)
|
||||||
{
|
{
|
||||||
$receiversArray[] = $event->subtask->user->email;
|
$receiversArray[] = $event->subtask->user->email;
|
||||||
$receiversArray[] = \App\Models\User::find($event->subtask->created_by)->email;
|
$creator = \App\Models\User::find($event->subtask->created_by);
|
||||||
|
|
||||||
|
if ($creator)
|
||||||
|
$receiversArray[] = $creator->email;
|
||||||
|
|
||||||
Mail::to( $receiversArray )->send( new \App\Mail\SubTaskDeleted( $event->subtask ) );
|
Mail::to( $receiversArray )->send( new \App\Mail\SubTaskDeleted( $event->subtask ) );
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -59,10 +59,11 @@ class SendEditedSubTaskNotification implements ShouldQueue
|
|||||||
|
|
||||||
// ukoncenie sub tasku - Pokiaľ je sub task ukončený s vyšším počtom vykázaných hodín ako bol pôvodne zadaný, posiela sa e-mailová notifikácia o tejto skutočnosti zadávateľovi master tasku (soft warning).
|
// ukoncenie sub tasku - Pokiaľ je sub task ukončený s vyšším počtom vykázaných hodín ako bol pôvodne zadaný, posiela sa e-mailová notifikácia o tejto skutočnosti zadávateľovi master tasku (soft warning).
|
||||||
if ($key == 'is_finished' && $diff == 1 && $event->subtask->tracked_time > $event->subtask->estimated_time) {
|
if ($key == 'is_finished' && $diff == 1 && $event->subtask->tracked_time > $event->subtask->estimated_time) {
|
||||||
$creatorEmail = User::find($event->subtask->created_by)->email;
|
$creator = User::find($event->subtask->created_by);
|
||||||
|
|
||||||
Mail::to( $creatorEmail )->send( new \App\Mail\SubTaskFinishedWithHigherTrackedTime( $event->subtask ) );
|
|
||||||
|
|
||||||
|
if ($creator) {
|
||||||
|
Mail::to( $creator->email )->send( new \App\Mail\SubTaskFinishedWithHigherTrackedTime( $event->subtask ) );
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
$difference[$key] = $diff;
|
$difference[$key] = $diff;
|
||||||
|
|||||||
@@ -28,8 +28,11 @@ class SendFinishedTimeBlockNotification implements ShouldQueue
|
|||||||
*/
|
*/
|
||||||
public function handle(TimeBlockFinished $event)
|
public function handle(TimeBlockFinished $event)
|
||||||
{
|
{
|
||||||
$receiver = User::find($event->timeblock->subtask->created_by)->email;
|
$receiver = User::find($event->timeblock->subtask->created_by);
|
||||||
|
|
||||||
Mail::to( $receiver )->send( new \App\Mail\TimeBlockFinished( $event->timeblock->subtask ) );
|
// pripad ked bol user soft deletnuty
|
||||||
|
if (!$receiver ) return;
|
||||||
|
|
||||||
|
Mail::to( $receiver->email )->send( new \App\Mail\TimeBlockFinished( $event->timeblock->subtask ) );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -15,7 +15,7 @@ class Blocker extends Model
|
|||||||
|
|
||||||
public function user()
|
public function user()
|
||||||
{
|
{
|
||||||
return $this->belongsTo(User::class);
|
return $this->belongsTo(User::class)->withTrashed();
|
||||||
}
|
}
|
||||||
|
|
||||||
public function getColorAttribute()
|
public function getColorAttribute()
|
||||||
|
|||||||
@@ -35,10 +35,8 @@ class MasterTask extends Model
|
|||||||
// vracia userov, ktori su priradeni k subtasku ale nepatria do teamu
|
// vracia userov, ktori su priradeni k subtasku ale nepatria do teamu
|
||||||
public function getUsersOutsideTeamAttribute()
|
public function getUsersOutsideTeamAttribute()
|
||||||
{
|
{
|
||||||
$users = $this->subtasks->pluck('user')->unique();
|
|
||||||
|
|
||||||
//remove null values - priprady, kedy bol user zmazany
|
$users = $this->subtasks->pluck('user')->unique();
|
||||||
$users = $users->filter();
|
|
||||||
|
|
||||||
// ak nie je uvedeny ziaden team, tak sa vratia vsetci useri
|
// ak nie je uvedeny ziaden team, tak sa vratia vsetci useri
|
||||||
if (!$this->team){
|
if (!$this->team){
|
||||||
@@ -46,7 +44,7 @@ class MasterTask extends Model
|
|||||||
}
|
}
|
||||||
|
|
||||||
return $users->filter(function ($user) {
|
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());
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -20,7 +20,7 @@ class SubTask extends Model
|
|||||||
|
|
||||||
public function user()
|
public function user()
|
||||||
{
|
{
|
||||||
return $this->belongsTo(User::class);
|
return $this->belongsTo(User::class)->withTrashed();
|
||||||
}
|
}
|
||||||
|
|
||||||
public function timeblocks()
|
public function timeblocks()
|
||||||
|
|||||||
@@ -15,6 +15,6 @@ class Team extends Model
|
|||||||
|
|
||||||
public function users()
|
public function users()
|
||||||
{
|
{
|
||||||
return $this->belongsToMany(User::class);
|
return $this->belongsToMany(User::class)->withTrashed();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -22,6 +22,6 @@ class Timesheet extends Model
|
|||||||
|
|
||||||
public function user()
|
public function user()
|
||||||
{
|
{
|
||||||
return $this->belongsTo(User::class);
|
return $this->belongsTo(User::class)->withTrashed();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -2,18 +2,16 @@
|
|||||||
|
|
||||||
namespace App\Models;
|
namespace App\Models;
|
||||||
|
|
||||||
use App\Mail\PasswordReset;
|
|
||||||
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
||||||
use Illuminate\Foundation\Auth\User as Authenticatable;
|
use Illuminate\Foundation\Auth\User as Authenticatable;
|
||||||
use Illuminate\Http\Request;
|
|
||||||
use Illuminate\Notifications\Notifiable;
|
use Illuminate\Notifications\Notifiable;
|
||||||
use Illuminate\Support\Facades\Mail;
|
|
||||||
use Laravel\Sanctum\HasApiTokens;
|
use Laravel\Sanctum\HasApiTokens;
|
||||||
use Laravel\Sanctum\PersonalAccessToken;
|
use Laravel\Sanctum\PersonalAccessToken;
|
||||||
|
use Illuminate\Database\Eloquent\SoftDeletes;
|
||||||
|
|
||||||
class User extends Authenticatable
|
class User extends Authenticatable
|
||||||
{
|
{
|
||||||
use HasApiTokens, HasFactory, Notifiable;
|
use HasApiTokens, HasFactory, Notifiable, SoftDeletes;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The attributes that are mass assignable.
|
* The attributes that are mass assignable.
|
||||||
|
|||||||
@@ -0,0 +1,32 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
use Illuminate\Database\Migrations\Migration;
|
||||||
|
use Illuminate\Database\Schema\Blueprint;
|
||||||
|
use Illuminate\Support\Facades\Schema;
|
||||||
|
|
||||||
|
return new class extends Migration
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* Run the migrations.
|
||||||
|
*
|
||||||
|
* @return void
|
||||||
|
*/
|
||||||
|
public function up()
|
||||||
|
{
|
||||||
|
Schema::table('users', function (Blueprint $table) {
|
||||||
|
$table->softDeletes();
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Reverse the migrations.
|
||||||
|
*
|
||||||
|
* @return void
|
||||||
|
*/
|
||||||
|
public function down()
|
||||||
|
{
|
||||||
|
Schema::table('users', function (Blueprint $table) {
|
||||||
|
//
|
||||||
|
});
|
||||||
|
}
|
||||||
|
};
|
||||||
Reference in new issue
Block a user