改进 工单回复以及邮件通知
This commit is contained in:
parent
dd49c870f6
commit
ae4233bb39
@ -25,7 +25,7 @@ public function store(Request $request, WorkOrder $work_order): RedirectResponse
|
|||||||
'content' => 'required|string',
|
'content' => 'required|string',
|
||||||
]);
|
]);
|
||||||
|
|
||||||
if (!$work_order->isOpen()) {
|
if ($work_order->isFailure()) {
|
||||||
return back()->with('error', '工单还未就绪。');
|
return back()->with('error', '工单还未就绪。');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -9,6 +9,7 @@
|
|||||||
use App\Models\User;
|
use App\Models\User;
|
||||||
use App\Notifications\WorkOrder as WorkOrderNotification;
|
use App\Notifications\WorkOrder as WorkOrderNotification;
|
||||||
use GeneaLabs\LaravelModelCaching\Traits\Cachable;
|
use GeneaLabs\LaravelModelCaching\Traits\Cachable;
|
||||||
|
use Illuminate\Broadcasting\PrivateChannel;
|
||||||
use Illuminate\Database\Eloquent\Model;
|
use Illuminate\Database\Eloquent\Model;
|
||||||
use Illuminate\Database\Eloquent\Relations\BelongsTo;
|
use Illuminate\Database\Eloquent\Relations\BelongsTo;
|
||||||
use Illuminate\Database\Eloquent\Relations\HasMany;
|
use Illuminate\Database\Eloquent\Relations\HasMany;
|
||||||
@ -83,13 +84,6 @@ protected static function boot()
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
public function routeNotificationForMail(WorkOrderNotification $work_order): array
|
|
||||||
{
|
|
||||||
$user = $work_order->user;
|
|
||||||
|
|
||||||
return [$user->email => $user->name];
|
|
||||||
}
|
|
||||||
|
|
||||||
public function scopeThisModule($query)
|
public function scopeThisModule($query)
|
||||||
{
|
{
|
||||||
return $query->where('module_id', auth('module')->id());
|
return $query->where('module_id', auth('module')->id());
|
||||||
@ -148,4 +142,16 @@ public function safeDelete(): bool
|
|||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function routeNotificationForMail(WorkOrderNotification $work_order): array
|
||||||
|
{
|
||||||
|
$user = $this->user;
|
||||||
|
|
||||||
|
return [$user->email => $user->name];
|
||||||
|
}
|
||||||
|
|
||||||
|
public function receivesBroadcastNotificationsOn(): string
|
||||||
|
{
|
||||||
|
return new PrivateChannel('users.' . $this->id);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user